Goto particular path when push notification arrives (Angular, Ionic, ngcordova)

Consider this scenario. I have an ionic / angular app and I am using the the ngcordova plugin for push notifications. Now let us say a push notification arrives when the app is in the background. User, views the notification in the App drawer and then clicks the notification for further information. I would like the user to navigate to a particular path using $location.path(). How can I tap into the notification click event?

-------------Problems Reply------------

Ok. Turns out that there is no need to tap into the notification click event. You could check if the app is in foreground using:

notification.foreground

so, if

if(notification.foreground) {
//do something for the case where user is using the app.
$popup('A notification just arrived');
} else {
//do something for the case where user is not using the app.
$location.path('/tab/somepage');
}

Category:android Views:4 Time:2018-06-02

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.211 (s). 11 q(s)