1

How can I tell, in cordova, if the app was started because of a regular click on the icon, or a click on the push notification, before the 'onNotification' is called?

I'm using the push-plugin, but until the 'notification' event is called, I'm already within the app itself, and the view "jumps" to the new notification event, which doesn't look good.

Yossale
  • 14,165
  • 22
  • 82
  • 109

1 Answers1

0

Any code you put in the onNotification callbacks will only be triggered if the application was launched by clicking on the notification.

UPDATE

  • To prevent your view from jumping to new notification event, add conditionals to check state and prevent or pause view 'jumps'.

See this answer I wrote for iOS.

Community
  • 1
  • 1
Ajoy
  • 1,838
  • 3
  • 30
  • 57
  • I want to know that before I'm inside the onNotification :) – Yossale Nov 26 '15 at 08:58
  • The `onNotification` is the callback for your use case. If you need to override that, theoretically, you will have to modify the plugin; add another callback that triggers before `onNotification`. But that doesn't make sense! Perhaps you could elaborate why exactly you need that. – Ajoy Nov 26 '15 at 09:19