Issue Integrating Push Notification with Pivotal CF


#1

Plugin: phonegap-plugin-push

We have set up a Push Notification service on Pivotal CF which we will use to handle our push notification. Any API calls will be appended to the URL of our server. So far I have managed to register the app with Pivotal using POST /v1/registration which I used the registrationId I have obtained during the registration of the push notification plugin. But making a request to POST /v1/push does not work.

Expected Behaviour

For request to Pivotal CF POST /v1/push to trigger a push notification to my phone

Actual Behaviour

Requesting a push notification from POST /v1/push returns status:200 and it’s respective response payload is as per written in the [documentation](pivotal push) (refer below) but no push notification appears on my phone.

{
  "receipt_id": "673369e9-9931-41f6-8675-69d603cfa4ec",
  "schedule_id": null
}

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  1. ionic start appname blank
  2. cordova plugin add phonegap-plugin-push --variable SENDER_ID="123456"
  3. ionic platform add ios (if somehow missing)
  4. ionic build ios
  5. Open XCode

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS 9.3.4

Cordova CLI version and cordova platform version

cordova --version                   6.3.1
cordova platform version ios        ios 4.2.1

Plugin version

cordova plugin version | grep phonegap-plugin-push        
-> phonegap-plugin-push 1.8.1 "PushPlugin"

Sample Push Data Payload

Not sure since Pivotal handles this

Sample Code that illustrates the problem

console.log('init registration');
var push = PushNotification.init({
  "android": {
    "senderID": "123456" // im not testing on Android (yet)
  },
  "ios": {
    "alert": "true",
    "badge": "true",
    "sound": "true"
  }
});

push.on('registration', function(data) {
  console.log('on registration');
  console.log(data);
  // data.registrationId
});

push.on('notification', function(data) {
  // data.message,
  // data.title,
  // data.count,
  // data.sound,
  // data.image,
  // data.additionalData
  console.log('on notification');
  console.log(data);
});

push.on('error', function(e) {
  //alert(e.message);
  console.log('on error');
  console.log(e);
});

Logs taken while reproducing problem

2016-08-24 17:06:22.882 eXtra + Push[1843:1002537] init registration
2016-08-24 17:06:22.886 eXtra + Push[1843:1002573] Push Plugin register called
2016-08-24 17:06:22.887 eXtra + Push[1843:1002573] PushPlugin.register: setting badge to false
2016-08-24 17:06:22.887 eXtra + Push[1843:1002573] PushPlugin.register: clear badge is set to 0
2016-08-24 17:06:22.887 eXtra + Push[1843:1002573] PushPlugin.register: better button setup
2016-08-24 17:06:22.887 eXtra + Push[1843:1002573] GCM Sender ID (null)
2016-08-24 17:06:22.888 eXtra + Push[1843:1002573] Using APNS Notification
2016-08-24 17:06:22.897 eXtra + Push[1843:1002537] Push Plugin register success: <SOME_RANDOM_NUMBERS_HERE>
2016-08-24 17:06:22.947 eXtra + Push[1843:1002537] on registration
2016-08-24 17:06:22.947 eXtra + Push[1843:1002537] {"registrationId":"MY_REGISTRATION_ID_HERE"}

Any suggestions would be greatly appreciated!


#2

Hello,
I have the same problem. Did you find a solution ?


#3

Hi Clement.

It was just me creating the push certificates wrongly. I just had to redo it and it worked already

Cheers


#4

Oh, i have not the same problem

Push[1843:1002573] GCM Sender ID (null)
Push[1843:1002573] Using APNS Notification
Push[1843:1002537] Push Plugin register failed

Do you have any idea please ?


#5

I believe this is also coz of incorrect certificates


#6

I redo all my certificates for development. My iOS Provisioning Profiles for developement is active.
But I still have this error :frowning:

Thanks for you help @xavianaxw


#7

I found a solution!
Remove platform folder and ionic platform add ios …
And it works :open_mouth: