IF condition for Xamarin.iOS and Xamarin.Android in Xamarin project

1.4k views Asked by At

I am new to the Xamarin and trying to create Liveswitch project (https://help.frozenmountain.com/docs/liveswitch/release-notes)

Project this : Liveswitch demo project have Xamrine project which had below structure:

Shared project (it has Chat.shproj) 
Android project
iOS project

I wanted to create Xamrine Project

Xamarin Project (this has Chat.csproj) 
Android Project 
iOS project

When i try to use. Xamarin Project (this has Chat.csproj) and code app.xaml.cs like below :

#if __ANDROID__
using Android.Content;
#endif

    using FM.LiveSwitch;
    using System;
    using Xamarin.Forms;

    namespace Chat
    {

         public partial class App : Xamarin.Forms.Application
            {
        #if __IOS__
                public App()
                {
        #else
                public App(Intent screenshareIntent)
                {
        #endif
                    InitializeComponent();
        #if __IOS__
                    MainPage = new NavigationPage(new SessionSelector());
        #else
                    MainPage = new NavigationPage(new SessionSelector(screenshareIntent));
        #endif
                    AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                }

It shows me error that Intent not found. i.e it is not allowing me to write conditional coding for method definition for Android and iOS in different way.

But in Shared project it is allowing me to write it. Is there any way i can do that in Xamarin project ? I am using visual studio for MAC version 8.5

Other problem is if i user Shared project and try to use

LoadApplication(new App(screenCaptureIntent));

MainActivity.cs not able to find files in the sharedproject. How can i connect files of shared project with files in android and iOS project in Xamarine.

0

There are 0 answers