My first instinct is to use the service resolver to pick the right
For example in the fh-xamarin-sdk push APIs we have a interface IPush which
is accessed as follows
ServiceFinder is responsible for determining which implementation is
currently linked in the app. What this means is that when you build
xamarin forms for iOS you depend on the iOS implementations in your build
configuration and likewise for Android. This is probably easiest if you
have an Android and iOS forms project which bootstrap the whole thing.
IPush Shared code :
Android IPush impl :
Ios push impl :
Example Xamarin apps :
I know these aren't forms apps and that creates a bit of a roadblock to
your question, but I think Xamarin is meant to have a bunch of small
platform specific projects with a few common ui projects. There are a few
videos where MS talks about developing Xamarin apps that I can hunt down if
people are interested.
On Fri, Apr 20, 2018 at 8:59 AM, Vojtech Sazel <vsazel(a)redhat.com> wrote:
we encountered a problem with Aiden and Massimo with the underlying
architecture of the multiplatform project in Xamarin.
We need to have Auth service module accessible from application. But
module has some platform specific implementations we need to get.
1) Suppose we have some class Auth implementing IServiceModule. We would
have it implemented only using platform-independent. So we can simply do
2) But now we need to have some platform specific stuff done in the
module, so we create AuthAndroid and AuthIOS extending Auth (which is now
abstract) in platform specific projects.
In ordinary pure Android (or iOS respectively) app we can do:
3) But we can't do that with Xamarin.Forms app where stuff is in platform
We can utilize DependencyService in Xamarin.Forms app project or create
separate Xamarin.Forms project with Auth, but it seems that code won't be
very pretty in this case.
What can we do to solve this problem?
I think we can debate it further after todays ST1 standup.
SENIOR SOFTWARE ENGINEER, RED HAT MOBILE
Remote Czech Republic
vsazel(a)redhat.com IM: vsazel