Start a new topic

Phonegap push notification not registering

Hi,


I have developed an app on Phonegap with Kinvey's phonegap sdk. Now I am trying to implement push notification. But when I build my app and run it on my iOS11 device using Xcode, the registration through APNS happens and I get a token, but the Kinvey.push.register function fails.


The error I get is:

ERROR: {"name":"KinveyError","message":"Kinvey currently only supports push notifications on iOS and Android platforms.","stack":"o@https://da189i1jfloii.cloudfront.net/js/kinvey-phonegap-sdk-3.10.1.min.js:


I am using the following code:

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

push.on('registration', function(data) {
myApp.alert(data.registrationId);
Kinvey.Push.register(data.registrationId).then(function() {
console.log('Device has been registered.');
myApp.alert('registered');
}).catch(function(error) {
console.error(error);
myApp.alert(error);
});

});

push.on('notification', function(data) {
console.log(data);
myApp.alert('Notified');
});
1 Comment

Hi Divey,


It seems that you are passing a string or number to the Push.register() method, when an object is expected and that leads to the error. 

Please review the documentation here for registering a device for push notifications.


Regards

Martin

Login or Signup to post a comment