Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49164

Push Notification $state.go

$
0
0

@jobhuntpacific wrote:

Hi,

I am fairly new to Ionic. I am having some issues with push notification "onNotification" event firing when the app is the active app i.e redirecting to specific page. From my understanding, the onNotification is only supposed to fire when the user clicks on the notification. Appreciate any assistance. Code below:

var push = new Ionic.Push({
"debug": true,
"onNotification": function (notification) {
var payload = notification.payload;
$rootScope.JobId = payload.jid;
$state.go('fst.jobdetail');
console.log(notification, payload);
},
"onRegister": function (data) {
$rootScope.deviceToken = data.token;
console.log(data.token);
},
"pluginConfig": {
"ios": {
"alert": true,
"badge": true,
"sound": true,
"vibrate": true
},
"android": {
"sound": true,
"vibrate": true
},
}
});

    var callback = function (pushToken) {
        console.log(pushToken.token);
        push.saveToken(pushToken);
    }

    push.register(callback);

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49164

Trending Articles