Push notification using PushPlugin returns OK and not reg id

Nope, the docs seems to be insufficient in this case. I do it like this:

$rootScope.$on('pushNotificationReceived', function (event, resp) {
    var notification = resp.notification;

    console.log("PUSH RECEIVED: (" + notification.event + ")", event, resp);

    if (notification.event == "registered") {
        //console.log("notification:", notification.regid);
    }
    
});

$cordovaPush.register("things").then(function (token) {
        // if device is iOS you will get token here, if Android you'll get it in pushNotificationReceived event
       console.log(token);
    }, function (err) {
        console.log(err);
    });
1 Like