How to open specific page after clicking on notification when the app is closed?

elpoussinoelpoussino FRMember ✭✭

I'm actually working on a Xamarin Forms application that need push notifications. I use the Plugin.PushNotification plugin.

When the app is running in the foreground or is sleeping (OnSleep), I have no problem to open a specific page when I click on a notification that I receive. But I was wondering how can I do that when the app is closed. Thanks!

Answers

  • AdamMeaneyAdamMeaney USMember ✭✭✭✭✭

    If you look at the code in that repository, you can see it caching the OnNotificationOpened event until someone subscribes to it.

    If you subscribe to it in your Forms side, you can push whatever page you want onto the stack and manage it just like you would any other Navigation event, just subscribe once your app is setup and ready to go.

    I have a PR in for the same functionality on iOS in their Firebase Plugin, it shouldn't be hard to do the same in the original.

Sign In or Register to comment.