What is most commonly used strategy? I'm trying now to implement following:
On application start:
Is this right approach? What is the best way to store device Id locally?
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With