I am trying to get notifications up and running in my Xamarin.Android project. For some reason, when I run the app on my phone, it crashes and returns null. I've been dealing with this for a while now, but I don't seem to understand what the problem is.
I already tried with saving the context on a variable at the beggining and calling it later when needed, but it doesn't work either.
Here is my OnCreate method, including the line that causes the error:
protected override void OnCreate(Bundle bundle)
{
if (Intent.Extras != null)
{
foreach (var key in Intent.Extras.KeySet())
{
var value = Intent.Extras.GetString(key);
Log.Debug(TAG, "Key: {0} Value: {1}", key, value);
}
}
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
if (!Resolver.IsSet) SetIoc();
LayoutInflater inflater;
Context context = this.BaseContext;
inflater = LayoutInflater.FromContext(context);
View dialogView = inflater.Inflate(Resource.Layout.Main, null);
SetContentView(Resource.Layout.Main);
msgText = dialogView.FindViewById<TextView>(Resource.Id.msgText);
IsPlayServicesAvailable();
Xamarin.FormsMaps.Init(this, bundle);
Xamarin.Forms.Forms.Init(this, bundle);
FormsControls.Droid.Main.Init(this); //this one is crashing
LoadApplication(new App());
FirebaseApp app = FirebaseApp.InitializeApp(this);
ConfigureFireBase();
}