OnNotificationOpened runs more than once
Hello, I receive notifications well, but I have noticed that, for example, if I install the application for the first time on the device, the method: OnNotificationOpened is executed 2 times, and when the application is already installed and I only update, it executes more than 3 times, this is annoying because I give it parameters so that through this method it can go to the view that I want, does it mean that this method makes it go to a view 3 times, has this happened to someone?
` CrossFirebasePushNotification.Current.OnNotificationOpened += async (s, p) => { if (data.Key=="moredata") { tag = (string)data.Value; } ........here I recover the parameters......................
await Navigation.PushAsync(new ListRequest(), false); } `
I can confirm I have this same issue. OnNotificationOpened gets executed twice
OnNotificationOpen is executed the number of times per notification, it increases each time by 1, I have a splashscreen and I use the sample example.
any solution? @rdelrosario @tarekka @jpolocosme
if you have splashscreen with this code it solves:
var mainIntent = new Intent (Application.Context, typeof (MainActivity));
if (Intent.Extras! = null)
{
mainIntent.PutExtras (Intent.Extras);
}
mainIntent.SetFlags (ActivityFlags.SingleTop | ActivityFlags.ClearTop);
@jpolocosme @angelru Subscribe to the events in the OnStart() event of App.xaml.cs instead of the constructor. I was doing it in the constructor and after moving it to OnStart it worked.
@Tarekka @jpolocosme
I can confirm it works as expected, thanks :)
This does not work for me.
OnStart() still getting triggered after tapping on the notification box so I have to unregister and register on the events
I ended up making a separate class and putting all the plugin events there and then checking if my class is null or not
private static FirebaseConfService firebaseConfService;
public static void InitFirebaseConf()
{
if (firebaseConfService is null)
{
firebaseConfService = new FirebaseConfService();
}
}
I just add this:
static bool firebaseInitialized = false;
...
if (firebaseInitialized )
return;
firebaseInitialized = true;
CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
...