Ios how to navigate to a specific page when a push notification is opened

nativescriptcore
ios

#1

Hi,
I’m developing a feature for an app that is made in NS core (vanilla JS) and I can’t achieve this on ios:

When the app is not running (killed) and a push notification is received the app should navigate to a specific page when the user opens the notification.

I’m using onesignal SDK and it is working in all case for Android by using a page that uses context and navigates to the following page according it.
In the case of ios the partial solution is to navigate from the “on opened push message” and it works when the app is suspended and also in foreground.

Page architecture is:
app.js (main page) --> home.js (here is the redirection logic in onNavigatedTo event) --> notification_detail.js (this is the page i want to navigate when a push is opened)

As I see there isn’t a consistent navigation between android and ios because on android works by navigation from a page and on ios (partially) by navigating fro “on opened push notification handler”.

By now the only solution I think it can work is to be able to detect when the app (being killed previously) it is been launched because the user has opened the push notification (it’s is far from being a perfect solution and by now I don’t know how to detect this).
(by the way on ios I couldn’t make it work that the on received message event were triggered when the app is killed)

Any ideas?

Thank you in advance


#2

I use Firebase for push notifications, the plugin is well maintained and perfectly works on both iOS and Android with same use case.

May I know where / which event you use to write your navigation piece of code in iOS?