14

Is there any possibilities for a device token to change after the app is installed and registered for the notification in any kind of scenarios.

Scenarios like:

  • App update
  • iOS update or in any other random scenario's.
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Jayanth Gowda
  • 179
  • 1
  • 1
  • 5
  • No, Device token will always be same . – sourav Oct 21 '16 at 06:08
  • Possible duplicate of [Does the APNS device token ever change, once created?](http://stackoverflow.com/questions/6652242/does-the-apns-device-token-ever-change-once-created) – ajay_nasa Oct 21 '16 at 06:21

1 Answers1

22

Previously in document it was like,

If the user restores backup data to a new device or reinstalls the operating system, the device token changes.

From new documentation here:

https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html

Important: To protect user privacy, do not attempt to use a device token to identify a device.

APNs can issue a new device token for a variety of reasons:

  • User installs your app on a new device

  • User restores device from a backup

  • User reinstalls the operating system

  • Other system-defined events

As a result, apps must request the device token at launch time, as described in APNs-to-Device Connection Trust and Device Tokens.

Michal Šrůtek
  • 1,647
  • 16
  • 17
Ronak Chaniyara
  • 5,335
  • 3
  • 24
  • 51
  • 3
    will didRegisterForRemoteNotificationsWithDeviceToken get called again after updating the OS? I'm not sure when should I be expecting to get the new updated token. Thanks! – binsnoel Feb 22 '19 at 07:54
  • 1
    More importantly, what happens to the user topic subscriptions when the device token changes? When I detect a token change, do I have to un-subscribe the users original token from all the topics they were subscribed to and then re-register the user for all the same topics using the new token? Or is this somehow auto-managed in the background - FCM auto removes bad tokens and reassigns new tokens for all the user subscribed topics? – rolinger Aug 12 '19 at 12:45
  • 1
    you should call `registerForRemoteNotifications` on every start of the app. The `didRegisterForRemoteNotificationsWithDeviceToken` will be called with an up-to-date token, which you then have to give to your backend somehow. – dube Oct 15 '20 at 13:57