Question about device tokens for push

Hi all,

I was wondering how the device tokens work for push notifications.
Are they always valid, or do they automatically become invalid after a certain time?

Do they stay the same after re-installing the app?


It depends on what are you using.

Assuming that you will use gcm without a third party server:
gcm token do expire in some cases:
No panic, just refresh the token. All you need to do is ask for a new one. Your app can do it periodically and send it to your server.

Thanks for your reply.

I’m using the API from Ionic Push and send the notifications via a curl request on my server.

The device tokens that appear with the users on, do they become invalid at some point?

I’m wondering the same. I have an older ionic app with push notifications and am considering migrating to Push. Also, if tokens aren’t constant and the same device registers multiple tokens what’s going to happen if we send both tokens… will it result in double notifications?

Lastly, are the tokens generated by Ionic Push going to be the same as generated by the old pushplugin (meaning, are the device specific or software specific, or a combination)?

Hopefully I’ve added to and not derailed the original question(s).


@wg1 How do you refresh the token?

I’m not sure, old topic :slight_smile: But I think PushNotification.init handles the refresh and you just listen to the registration event:

push.on('registration', function(data) {
  //send data.registrationId to the server

*This is for phonegap-plugin-push.