I'm using this plugin here:
https://github.com/phonegap-build/PushPlugin
Where is the behavior that gives me an option to redirect to a certain view in my angular app?
For the sake of example, in ios device it's configured as follows:
window.onNotificationAPN = function (event) {
if (event.alert) {
window.plugins.pushNotification.alert(event.alert);
}
if (event.sound) {
var snd = new Media(event.sound);
snd.play();
}
if (event.badge) {
window.plugins.pushNotification.setApplicationIconBadgeNumber(
function (result) {
console.log('Success - ' + result);
},
function (error) {
console.log('Error - ' + error);
},
event.badge);
}
};
Im guessing somewhere in here suppose to be a code that says:
if you pressed the push, and now your here, redirect to somewhere you like.... is it possible?
You can use
$location.path()
to switch / change the current route in angular. That should be possible on notification too, as long as you have access to the$location
service in the push callback. You could register it inangular.module(...).run()
: