Ionic 1: push notifications not showing up/working?


#1

Hello,

I followed exactly the documentation, to add push notification to an Android app, from here


Things work partially:

  • this code works fine:
$ionicPlatform.ready(function () {
    console.log('Trying to register device to get a GCM/APNS (Google Cloud Messaging/Apple Push Notification Service) TOKEN');
    $ionicPush.register().then(
        function (t) {
            console.log('Device Registered with GCM/APNS (Google Cloud Messaging/Apple Push Notification Service) to get a push token: ' + JSON.stringify(t));
            console.log('Trying to save the token within GCM/APNS (Google Cloud Messaging/Apple Push Notification Service): ' + JSON.stringify(t));
            $ionicPush.saveToken(t).then(
                function(savedToken) {
                    console.log('GCM/APNS (Google Cloud Messaging/Apple Push Notification Service) Push Notifications Token saved:' + JSON.stringify(savedToken));
                    deferred.resolve(savedToken);
                },
                function(error) {
                    var msg = 'Failed to save the GCM/APNS (Google Cloud Messaging/Apple Push Notification Service) Push Notifications Token; error:' + JSON.stringify(error);
                    console.log(msg);
                    deferred.reject(msg);
                }
            );
        },
        function(error) {
            var msg = 'FAILED to register device with GCM/APNS (Google Cloud Messaging/Apple Push Notification Service) to get a push token; error: ' + JSON.stringify(error);
            console.log(msg);
            deferred.reject(msg);
        }
    );
});
  • i mean the message in console:
_"GCM/APNS (Google Cloud Messaging/Apple Push Notification Service) Push Notifications Token saved:{"token":"c0OEAA44nqM:APA91bHF8ZzX0dPqDm-KamItFwZRA0aafE3LyaRZ4mq17_OoYHrod1vbHHdt1gICDQCDgyiiaz6SJD1657P3wEfJ48AAPB56KU6Mru1Fr_CH8ixyQ8I0h-Dd34dp6OmgppM0mdjFGXGd","registered":true,"id":"beb0b4b4038087e458e3e16cbfd63256","type":"android","saved":true}"_ 

which is fine

  • but then i register to listen for the event of notification like this:
$scope.$on('cloud:push:notification', function (event, data) {
    var msg = data.message;
    console.log('RECEIVED PUSH NOTIFICATION: ' + JSON.stringify(msg));
    alert(msg.title + ': ' + msg.text);
});
  • and i send the notification using the web interface at ionic.io:
    https://apps.ionic.io/app/a37d6c52/push/overview
    and nothing happens in the application on the mobile phone, nothing gets logged to the console, and no notification appears.

Can someone help me please ?
Thank you.


Ionic Push for iOS Dev not working
#2

Anyone please has any idea what to do to have the notifications working ?
Anyone else implemented the Ionic Push notifications lately and get a working solution ?

Thank you.


#3

visit bellow mentioned link of plugin it worked for me
https://github.com/phonegap-build/PushPlugin


#4

I have exactly the same issue. It’s working fine on IOS not on Andoid. Nothing happen