Is the device token as unique as the device ID?

Nielsou Hacken-Bergen picture Nielsou Hacken-Bergen · Aug 3, 2011 · Viewed 23.8k times · Source

If we reset an iPhone, the device ID remains the same. Is it the same for the device token?

Answer

user814037 picture user814037 · Aug 3, 2011

I assume you are referring to the device token available to methods such as

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

If this is the case, then no, the device token can and will change.

Quoted from Apples Local and Push Notification Programming Guide

By requesting the device token and passing it to the provider every time your application launches, you help to ensure that the provider has the current token for the device. If a user restores a backup to a device other than the one that the backup was created for (for example, the user migrates data to a new device), he or she must launch the application at least once for it to receive notifications again. If the user restores backup data to a new device or reinstalls the operating system, the device token changes. Moreover, never cache a device token and give that to your provider; always get the token from the system whenever you need it

I can also verify this behaviour as I use Urban Airship as my notification provider and even though I have only ever used a single test device so far, there are numerous device tokens registered with my account.