I can successfully send notifications to my app using the Google Firebase console, but the open event never fires (Android emulator running in Visual Studio 2019)
This is my MainApplication.cs file, simplified for brevity:
public class MainApplication : Application
{
public MainApplication(IntPtr handle, JniHandleOwnership transer) : base(handle, transer)
{
}
public override void OnCreate()
{
base.OnCreate();
CrossCurrentActivity.Current.Init(this);
// these events fire as expected
CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) =>
{
};
CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
{
};
// this doesn't
CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) =>
{
};
I'm using the FirebasePushNotificationsPlugin and my code is based on the samples that they provide.
Xamarin and mobile development is completely new to me and because I'm not sure where the issue lies, I'm reluctant to post reams of code, most of which might be irrelevant. However as some of the events the work and others don't, that seems a good place to start.
UPDATE - for clarity I've added some additional info:
I also have a SplashActivity.cs which has the MainLauncher = true attribute:
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
{
base.OnCreate(savedInstanceState, persistentState);
Log.Debug(TAG, "SplashActivity.OnCreate");
FirebasePushNotificationManager.ProcessIntent(this, Intent);
}
...
protected override void OnNewIntent(Intent intent)
{
base.OnNewIntent(intent);
FirebasePushNotificationManager.ProcessIntent(this, intent);
}
There is also MainActivity.cs which has this:
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
Xamarin.Essentials.Platform.Init(this, bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}