1

Each time an iOS app is installed a new device token is generated.

When the app asks the user for permission to push notifications one can get the new device token value.

How can I know that this device token is from the same device (e.g., the user has deleted and reinstalled the app) and not from another device used by the user? I want to replace the copy of the device_token stored on my server with the new value.

Carl
  • 131
  • 5
  • I think the point of these tokens is that you *cannot* track a device after your app was uninstalled. Consider also how you handle when a user revokes push notifications, when a device is sold, when a user switches devices, or when a user has multiple devices. Why do you need to distinguish whether the app was reinstalled on physically the same device, instead of installed on a different device? If you're bothered with old devices being associated with the account, just remove the tokens from your server when a push notification fails because the token is no longer valid. – amon Sep 14 '17 at 16:19
  • Or replace the old one after the login. So If the user change from device to device you will send the push allways to the latest device that started a session. – Laiv Sep 14 '17 at 20:40
  • Thanks - the suggestions mentioned were the type of options I am looking for. – Carl Sep 14 '17 at 21:14

1 Answers1

1

You can get the device UUID and store it on your server with push notificaiton deviceToken. Next time when you reinstall the app on the same device and when you will send the new deviceToken with device UUID to server then you will match previous device UUID and this new UUID you will get to know that device is same or not.

  • alas, UUID is not forever. This page explains: UUID will change when all apps from a vendor are removed. https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor – Carl Nov 17 '17 at 12:16