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

Ionic io push notifications call back

$
0
0

@TomBeech wrote:

Hi,

I'm trying to use the ionic.io push notification service. It works when the phones on standby/the apps not open - however my on received isnt fireing when a notification comes through.

I have this in my app.js:

  $ionicPlatform.ready(function() {
            $log.info('firing the run code..');
            var push = new Ionic.Push({
                "debug": false,
                "onNotification": function(notification) {
                    var payload = notification.payload;
                    console.log(notification, payload);
                    $log.info("SOMETHING HAS HAPPENED");
                },
                "onRegister": function(data) {
                    console.log(data.token);
                },
                "pluginConfig": {
                    "ios": {
                        "badge": true,
                        "sound": true
                    },
                    "android": {
                        "iconColor": "#343434"
                    }
                }
            });
        });

And the register I just have on the login:

var push = new Ionic.Push();
                        var callback = function(pushToken) {
                            console.log(pushToken.token);
                        }

                        push.register(callback);

However, it does register, i do get the callback token but I never get anything in onNotification

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>