Reputation: 1
As in this post i tried all the ways, but still not getting registration id. Kindly some one help me on this.
I am able to see the registration id in eclipse's logcat but it is not calling onNotificationGCM method.
Upvotes: 0
Views: 53
Reputation: 6257
First of all use latest push plugin. Install plugin to your project with this command:
ionic plugin add phonegap-plugin-push
To register your device use this line in your js code, this line will only register your device.
var push = PushNotification.init({ "android": {"senderID": "your-sender-id"}} );
Now that your device has been registered, and event with device token is generated from GCM service,which you can receive in your application using following code
push.on('registration', function(data) {
// data.registrationId , use this token
});
That is it. You do not have to use old plugin because latest one is more simpler to use. Here is link to documentation of latest plugin.
Upvotes: 1