how do I get a unique device id for an android device?

Is there a unity-android equiv of iPhoneSettings.uniqueIdentifier or native-android:

Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);

I've seen some other threads that point out various problems with the uniqueness of android device ids, but for now I really just need to know if there's an easy way to get the android id from unity.

2 Answers

2

As of Unity 3.4 (i think):
SystemInfo.deviceUniqueIdentifier

so it turns out SystemInfo.deviceUniqueIdentifier returns the IMEI number of the device. I don't know if this is the same as ANDROID_ID but it's causing us nightmares with our advertising programs attempting to track back conversions from ads we purchased.

It returns the IMEI if the AndroidManifest has the android.permission.READ_PHONE_STATE permission, otherwise it seems to be a generated-once random identified.

using iPhoneSettings returns valid information about android phones as well.

all properties of iPhoneSettings, such as model or uniqueIdentifier, return valid informations. so it returns “samsung GT-I9000” on my galaxy S phone and on uniqueIdentifier a 15 numeric-long string.

iPhoneSettings.uniqueIdentifier return IMEI, not Android id