Ionic 1 push notifications with phonegap-push-plugin and ionic cloud

I’m trying to make a notification app on iOS, and I’m really stuck here.

I followed all the steps in the documentation, I generated an apn_dev certification, I created a Security Profiles and I enabled notification in xcode project,
here is my libraries :

<script src="lib/bluebird.min.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic.cloud.min.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>

here is my app.js :

.config(function($ionicCloudProvider) {
    $ionicCloudProvider.init({
        "core": {
          "app_id": "xxxx"
        },
        "push": {
          "sender_id": "12345",
          "pluginConfig": {
            "ios": {
              "badge": true,
              "sound": true
            },
            "android": {
              "iconColor": "#343434"
            }
          }
        }
      });
    })
    .controller('MyCtrl', function($scope, $ionicPush) {
      $ionicPush.register().then(function(t) {
        return $ionicPush.saveToken(t);
      }).then(function(t) {
        console.log('Token saved:', t.token);
      });
      $scope.$on('cloud:push:notification', function(event, data) {
        console.log(data);
      }); 

The subscription works fine, I get the log saying :
Ionic Push: saved push token:XXXXXXX

And I even check the cloud server : The device token exists in the result of a GET : https://api.ionic.io/push/tokens

BUT when I try to send a notification to the device, I get nothing :confused: what am I missing?

Just to clarify:

You are testing on a real device?
You get a push token when you start the app?
Ionic Cloud registers this push token?
You can create a push to this token on Ionic Cloud and it says it sent and delivered it?

(Sorry if I used the wrong terms, long time since I did push on Ionic 1)

Hello Sujan12,
Yes, yes, yes and yes lol

Close the app, send push notification. Does iOS receive the notification and show it in the notification center?

still not receiving…

Try another device. Something’s fishy here.

I have exactly the same problem. Everything done as described by rachedanis, but still no notifications delivered, even if in my Dashboard it says that the notification was sent… Please help.

I’ve found that my messages get “UNKNOWN” error, found here https://github.com/driftyco/ionic-cloud/issues/133 that the problem is probably with certificates…

1 Like