- Home /
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.
Answer by sampenguin · Nov 16, 2011 at 11:25 PM
As of Unity 3.4 (i think): SystemInfo.deviceUniqueIdentifier
so it turns out SystemInfo.deviceUniqueIdentifier returns the I$$anonymous$$EI 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 I$$anonymous$$EI if the Android$$anonymous$$anifest has the android.permission.READ_PHONE_STATE permission, otherwise it seems to be a generated-once random identified.
Answer by zwacky · Jun 02, 2011 at 03:05 PM
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 I$$anonymous$$EI, not Android id