Ionic.io push notificat

Does anybody make the push notification work in ionic.io?

I followed the instruction and it works in Limited Mode. But no way to make it work for real device. Here is what I did. (Take ios as an example).

Ionic app

1.Create a blank app

ionic start pushdemo

2.Add new phonegap-push-plugin by following the instruction
3.Set the dev_push to false
4.Source code in app.js

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {

var push = new Ionic.Push({
  "debug": true
});
push.register(function(token) {
  alert(token.token);
  console.log("Device token:",token.token);
  push.saveToken(token);
});

5.Link my app to ionic.io

ionic io init

ios application

  1. Create app id in Apple Developer
  2. Create certificate for push notification for this app id
  3. Download the cert
  4. Export to p12 file with password 1234
  5. Create provisioning profile for this app
  6. Configure my app in xcode to this app id and this provisioning profile

In ionic.io dashboard

  1. Create an api token in API Tokens
  2. Create a security profile in ionic.io profie.
  3. Load the p12 file to this security profile and set the password to 1234
  4. Save it

But the push never works although I can get the device token in my real device. I tried to use curl command like this:

curl -X POST -H “Authorization: Bearer xxxxeXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI3NjI4MzUyNi1mZjMxLTRhMGItODAxOC0xZmM2ZTY0ZTA3N2YifQ.xCSZk4vQwKajGQ4TOoWyxxxIPnAxxxhYfDRMDrtxxxx” -H “Content-Type: application/json” -d ‘{ “tokens”: [“5137fcda88b7e4012dc7ac21e4d80f96d8702ee6cd6e08ac874a0b209a9882b0”], “profile”: “pushdemo_dev”, “notification”: { “message”: “Hello World!!!” }}’ “https://api.ionic.io/push/notifications”

Also tried to push in my ionic.io dashboard. None works for me. Any idea? Or is there anyway to debug this issue in ionic.io?

By the way, the API token is correct and I enabled the Push Notification when the app started at the first time.

1 Like