Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS push notifications - how to deal with device ID?

What is most commonly used strategy? I'm trying now to implement following:

On application start:

  • Get previously saved device Id from some local storage
  • Get device Id
  • If changed, save new Id, send update to server

Is this right approach? What is the best way to store device Id locally?

like image 258
Igor Romanov Avatar asked Jan 25 '12 15:01

Igor Romanov


People also ask

What is device ID in push notification?

Android HWID For Android devices, HWID is a random set of letters and digits generated by the first app with the Pushwoosh SDK installed on the device. It's later shared with other apps that contain Pushwoosh SDK so that all such apps will have the same HWID as a result.

What is device ID in iOS?

Apple device IDs Every Apple iPhone, iPod touch and iPad has a unique device ID number associated with it, known as a Unique Device ID (UDID). Apple's device ID is a 40-digit sequence of letters and numbers. Customers can access their device ID numbers in iTunes or by downloading a free app from the Apple App Store.

Where is iOS device ID?

Find your serial number, IMEI/MEID, or ICCIDGo to Settings > General and tap About. Look for the serial number. You might need to scroll down to find the IMEI/MEID, and ICCID. To paste this information into Apple registration or support forms, touch and hold the number to copy.

How do I manage push notifications on my iPhone?

Go to Settings and tap Notifications. Select an app under Notification Style. Under Alerts, choose the alert style that you want. If you turn on Allow Notifications, choose when you want the notifications delivered—immediately or in the scheduled notification summary.


1 Answers

Best practice is to send the push device token (not the same as the uniqueIdentifier mentioned by Serg Shiyan) to Apple every time the app starts. This will let Apple know your app is still active.

See registering for remote push notifications:

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.

from the Local and Push notifications Programming guide

In my experience there are a number of reasons why push tokens might be invalidated. These include app deinstalls and mixing apps with different certificates (dev, ad-hoc running against sandbox / live push servers). It will save you some debugging by sending the token on start each time as recommended.

So basically there is no reason to store the push token other than in memory while your app is running. You just request a new one (possibly the same one) the next time your app starts.

like image 138
Joris Kluivers Avatar answered Sep 19 '22 09:09

Joris Kluivers