Forum Xamarin.Forms

Xamarin.Forms Application State and Push Notifcation

jaysonragasajaysonragasa Member
edited January 21 in Xamarin.Forms

Trying to understand what's going on here.

Here's what's going on.

The application starts normally,
1. registers all dependency services
2. register/subscribe push notification events from Plugin.FirebasePushNotification library

Now when I receive a push notification and tap on the notification box. The app re-launches again and repeats the flow above, but now the problem comes in #2 where I subscribed to the "event"s because now it's triggering twice.

Got a push notification, I tap on it, it's now triggering 3x, 4x, 5x and so on..

One specific event I use is the OnNotificationOpened. That triggers when I tap on the notification box and it will open a specific page. Right now, what's going on is, after tapping on the notification box for the 3rd time for example, it will launch that page 3x as well so when I press the back button, I get back to the same page 2x.

How do you prevent these? How to tell the app that it's already running, so please do not re-register all the services that has been registerd and re-subscribe to the events that has already been subscribed to?

Thanks!

Sign In or Register to comment.