title: the app stopped on white screen when using microsoft intune in Xamarin.Android app
body: <p>after installing (Microsoft.Intune.MAM.Remapper.Tasks) plugin I get the following errors ,</p>
  <p>the app stops on the white screen,</p>
  <p>The reference I was following (<a href="https://docs.microsoft.com/en-us/mem/intune/developer/app-sdk-xamarin#enabling-intune-app-protection-policies-in-your-android-mobile-app" rel="nofollow noreferrer">click here</a>),</p>
  <p>I found a note in the reference link (If you encounter a blank, white screen in your application on launch, then you may need to force the navigation calls to execute on the main thread)
  you can find this note  in the Troubleshooting section, I don't understand what he meant</p>
  <p>Note: Before installing this plugin the app works fine.</p>
  <p>The pictures below give more information about my code</p>
  <p><strong>MainApplication.cs</strong></p>
  <pre><code>using System;
  using System.Collections.Generic;
  using Android.App;
  using Android.OS;
  using Android.Runtime;
  using Firebase;
  using Microsoft.Intune.Mam.Client.App;
  using Plugin.CurrentActivity;
  using Plugin.FirebasePushNotification;
  
     namespace test.Droid
      {
      #if DEBUG
          [Application(Debuggable = false)]
      #else
          [Application]
      #endif
          public class MainApplication : MAMApplication, MAMApplication.IActivityLifecycleCallbacks
          {
              public MainApplication(IntPtr handle, JniHandleOwnership transer) : base(handle, transer)
              {
              }
      
              public override void OnMAMCreate()
              {
                  base.OnMAMCreate();
      
                  if (Build.VERSION.SdkInt &gt;= Android.OS.BuildVersionCodes.O)
                  {     
                      FirebasePushNotificationManager.DefaultNotificationChannelId = &quot;FirebasePushNotificationChannel&quot;;
                      FirebasePushNotificationManager.DefaultNotificationChannelName = &quot;General&quot;;
                  }
      
                  RegisterActivityLifecycleCallbacks(this);
                
              }
      
              public override void OnTerminate()
              {
                  base.OnTerminate();
                  UnregisterActivityLifecycleCallbacks(this);
              }
      
              public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
              {
                  CrossCurrentActivity.Current.Activity = activity;
              }
      
              public void OnActivityDestroyed(Activity activity)
              {
              }
      
              public void OnActivityPaused(Activity activity)
              {
              }
      
              public void OnActivityResumed(Activity activity)
              {
                  CrossCurrentActivity.Current.Activity = activity;
              }
      
              public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
              {
              }
      
              public void OnActivityStarted(Activity activity)
              {
                  CrossCurrentActivity.Current.Activity = activity;
              }
      
              public void OnActivityStopped(Activity activity)
              {
              }
          }
      }
  </code></pre>
  <p><strong>AndroidManifest.xml</strong></p>
  <p><a href="https://i.stack.imgur.com/DX96k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DX96k.png" alt="enter image description here" /></a></p>
  <p><em>i have 3 class for MainActivity</em></p>
  <p><strong>MainActivity 1</strong></p>
  <pre><code>using Android.App;
  using Android.Content.PM;
  using Android.OS;
  using Almond.Core;
  using Plugin.Permissions;
  using System.Threading.Tasks;
  using System;
  using Plugin.FirebasePushNotification;
  
  namespace Almond.Droid
  {
      [Activity(ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, LaunchMode = LaunchMode.SingleTop, ScreenOrientation = ScreenOrientation.Portrait)]
      public class MainActivity : ES.Droid.MainActivity
      {
          public static MainActivity Instance { get; private set; }
  
          public MainActivity() : base(new Almond.Core.AppSetup())
          {
          }
  
          protected override void OnMAMCreate(Bundle bundle)
          {
              Instance = this;
  
              base.OnMAMCreate(bundle);
  
              FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);
  
              AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
              TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;
  
              Xamarin.Forms.Forms.Init(this, bundle);
              DisplayCrashReport();
              LoadApplication(new App());
              
              FirebasePushNotificationManager.ProcessIntent(this, Intent);
  
          }
  
          public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
          {
              Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
              PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
              base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
          }
  
         
      }
  }
  </code></pre>
  <p><strong>MainActivity 2 (inherit by MainActivity 1)</strong></p>
  <pre><code>using System;
  using Android.OS;
  using ES.Xam.Forms;
  using Plugin.Fingerprint;
  using Xamarin.Forms.Platform.Android;
  
  namespace ES.Droid
  {
      public class MainActivity : ES.Mobile.Android.AppActivity
      {
          public MainActivity(Xam.Forms.AppSetup appsetup)
          {
  
              AppContainer.Initialize(appsetup);
          }
  
          protected override void OnMAMCreate(Bundle bundle)
          {
  
              CrossFingerprint.SetCurrentActivityResolver(() =&gt; this);
              Xamarin.Essentials.Platform.Init(this, bundle);
  
              AppDomain.CurrentDomain.UnhandledException += (sender, e) =&gt;
              {
                  try
                  {
                      var ex = ((Exception)e.ExceptionObject).GetBaseException();
                      System.Diagnostics.Debug.WriteLine(&quot;**MAIN ACTIVITY EXCEPTION**\n\n&quot; + ex);
                      InsightsManager.Report(ex, InsightsManager.Severity.Error);
                  }
                  catch
                  {
                  }
              };
  
              FormsAppCompatActivity.ToolbarResource = Almond.Droid.Resource.Layout.toolbar;
              FormsAppCompatActivity.TabLayoutResource = Almond.Droid.Resource.Layout.tabs;
  
              global::Xamarin.Forms.Forms.SetFlags(&quot;FastRenderers_Experimental&quot;);
  
              global::Xamarin.Forms.Forms.Init(this, bundle);
  
              base.OnMAMCreate(bundle);
          }
      }
  }
  </code></pre>
  <p><strong>Base Activity (inherit by MainActivity 2)</strong></p>
  <pre><code>using Android.OS;
  using Xamarin.Forms.Platform.Android;
  
  namespace ES.Mobile.Android
  {
      public class AppActivity : FormsAppCompatActivity
      {
  
          protected override void OnMAMCreate(Bundle bundle)
          {
              base.OnCreate(bundle);
              
              Rg.Plugins.Popup.Popup.Init(this, bundle);
          }
  
          public override void OnBackPressed()
          {
              Rg.Plugins.Popup.Popup.SendBackPressed(base.OnBackPressed);
          }
      }
  }
  </code></pre>
  <p>thank you :)</p>