Sender ID Cordova Plugin Push

Asked

Viewed 107 times

0

I am developing an application that needs to be able to receive notifications via server, and for this, I opted to use a plugin called phonegap-plugin-push

var push = PushNotification.init({
  "android": {
      "senderID": "XXXXXXXX"
  },
  "ios": {
    "sound": true,
    "alert": true,
    "badge": true
  },
  "windows": {}
});

push.on('registration', function(data) {
  alert("registration event: " + data.registrationId);
  var oldRegId = localStorage.getItem('registrationId');
  if (oldRegId !== data.registrationId) {
      // Save new registration ID
      localStorage.setItem('registrationId', data.registrationId);
      // Post registrationId to your app server as the value has changed
  }
});

push.on('error', function(e) {
  console.log("push error = " + e.message);
});

push.on('notification', function(data) {
 console.log('notification event');
 navigator.notification.alert(
    data.message,         // message
    null,                 // callback
    data.title,           // title
    'Ok'                  // buttonName
 );
});

Where, regardless of the Sender ID used, it returns the same Device ID, I have already created other projects in google firebase, to change the senderID and consequently change the device ID, but always returns the same.

Thanks for your help

1 answer

0

I managed to solve, was using version 2.1.2, for some reason was not working properly with Android, so I had to downgrade to version 1.8.0, so it worked perfectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.