Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are push notification tokens unique across all apps for a single device?

I will have multiple applications on the app store and 1 urban airship account to send push notifications to all of these devices. What I want to know is if each Apple device has the same "push token" across all applications? This is more of a database architecture thing so that I don't duplicate a push token many times if one single device uses many of my apps.

If each Apple device generates a unique push token for each application it has installed my architecture needs to change.

like image 677
scootklein Avatar asked May 01 '10 20:05

scootklein


1 Answers

Device tokens are not exactly unique per device; they're unique per operating system installation. So if a user buys a new device but does not restore from backup, then they'll get a new device token. And if a device is wiped, it will get a new device token, so the new user doesn't get the old user's messages.

In addition, there are different tokens returned for development apps using the sandbox and distribution apps using the production system.

Since a single user might have your app installed on multiple devices legally (iPhone and iPad, for instance), it will be much safer to have a many to many relationship between users and device tokens, to be on the safe side.

And since you mentioned Urban Airship, you might find that our alias feature helps for this sort of thing; you can assign a non-unique alias to the different tokens in our end, and then we'll keep track of the mapping between your users and their device tokens. See the registration and push parts of the UA documentation.

Edit: An update because I saw some more upvotes on this old answer. As of iOS 7, device tokens are unique for each application, even on the same device.

like image 87
robotadam Avatar answered Oct 06 '22 00:10

robotadam