There are many reasons why you would need to track your application users. But unfortunately there isn’t such an API available in Adobe AIR. In our recent development, we needed to identify our users based on their devices. We were searching for an Adobe AIR Unique Device ID to somehow be able to identify users even if they are uninstalling/re-installing our app.
The bad news is that not even on the native side, there is not a simple answer to this question. No wonder why there is no such API on the AIR side. So, we decided to build a new ANE and call it UDID.
This ANE, will return all the different identifiers that the native side provides. Each of them are good for different occasions. I will explain them in more details in this post. It will be your job to see which one best suits your needs.
Android, Telephony Manager
If you are targeting smartphones, this option can be a good shot. but it has two downsides. The first disadvantage is that there are many Android devices like tablets which do not have any telephony API. That means, you will not be able to get a result from the Telephony Manager. The second disadvantage is that even on smartphones with the Telephony Manager API available, you need to ask users for the android.permission.READ_PHONE_STATE permission. Users might ask themselves why your game is asking for a phone access!
Android, Serial Number Identifier
On Android devices with no Telephony Manager, they may return a serial number. And even some smartphones return this serial number. It’s sad to say that some tablets do not return a value for this property at all! So, this is not very reliable as you can guess.
For Android devices, this could be your best shot. Android ID property is available on smartphones and tablets but it is a randomly generated string. And will remain the same for the lifetime of your device. But it will change upon ‘device factory reset’. We have also heard (have not experienced) that there is a known bug with this ID that a popular manufacture has built some devices which all have a similar Android ID!
The other solution is to use the UUID property. This identifier is unique based on app installations not the actual device.
iOS, Vendor ID
In older versions of iOS, you could have access to the device unique ID but newer versions of iOS have removed that access and instead they are providing developers with the vendor ID. I think you can rely on that because as the description explains, this ID is unique based on devices to the app’s vendor.
iOS, Android, Advert ID
From V1.1.0+ of this ANE, we now support Android and iOS Advert ID. The following links will help you understand Advert ID better and how/when you should use it in your apps:
In conclusion, if you are dealing with iOS, you can easily use the vendor ID property and you’ll be fine but if you are on Android, you need to make a decision on which option is best for you. We are suggesting you to use the Android ID.
Enjoy building AIR apps.