0

If I have a registered push App for IPhone or Android that App should only be activated when a push is made to the specific device token for that device.

So if the device token changes then the App will no longer be activated. There will then be no chance to test for and notify the web back end that the device token has changed as the App will not have run!

Is there a way of setting a "Device Token Changed" call that would notify the web back end when the token had changed - perhaps passing the old and new tokens, or an unique app stored identifier and the new token?

Ideally this solution would be usable in Android, IPhone and Windows 8 but partial solutions will be gratefully accepted.

Simon N
  • 27
  • 3
  • In iOS you could `RegisterForRemoteNotifications` every time on the app start. Then, in `DidRegisterForRemoteNotifications` you could send new device token to server. – Maxim Korobov Jul 29 '13 at 07:37
  • But the app won't start as the push will be to the old device token - not the new one. – Simon N Jul 29 '13 at 16:34
  • I'm not seeing any problems. Store on a server `device_id`-`device_token` (as a `device_id` you could use MAC address of Wi-Fi adapter.) dictionary. On `DidRegisterForRemoteNotifications` call server's method to update key-value pair. Thus, you'll always get actual value of `device_token`, so push-notification will be delivered. – Maxim Korobov Jul 29 '13 at 18:05
  • An application should register [with APN servers] every time it launches and give its provider the current token (http://stackoverflow.com/a/7999690/548395). – Maxim Korobov Jul 29 '13 at 18:07
  • Not really. 1) Register with current correct values. 2) app stops. 3) device token changes. 4) Push attempt is fired from server. 5) server has the wrong device token. 6) app doesn't start as wrong device token. 7) app doesn't update server. – Simon N Jul 31 '13 at 18:29
  • This situation is possible when iOS device was wiped or restored from backup. And it will be up to next app's start. – Maxim Korobov Jul 31 '13 at 18:57
  • Yes but also the device token changes automatically every two years; so once every two years the app will stop and never start again! – Simon N Aug 11 '13 at 13:34
  • Please provide reference about 2 years for iOS. Even so, if user do not launch an application so much time, it seems like he don't use it. I can't imagine the case when user wants to receive push-notifications, but don't want to lauch app for 2+ years. – Maxim Korobov Aug 12 '13 at 05:39
  • see http://stackoverflow.com/questions/6652242/does-the-device-token-ever-change-once-created?lq=1 – Simon N Sep 22 '13 at 21:44
  • But that does not mean that the app has not been used for two years; it could mean it was used yesterday but it was first registered two years ago - so the token is not the same today. – Simon N Sep 22 '13 at 21:46

0 Answers0