I’m trying to get android unique id i’m using this code to get android unique id
String phoneID = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);
when i use this code on sdk version 2.3 on emulator it work fine and return randomly generated android id, but when i use similar code in sdk version 2.0 it will return null,
i try this code also but same result,
String phoneID = System.getString(getContext().getContentResolver(), System.ANDROID_ID);
is there any another way to get android unique id? I’m testing my application on emulator.
See Stackoverflow – how-to-find-serial-number-of-android-device for other ways of getting unique ID for android device. Seva’s comment contains info about why you’re getting a NULL for ANDROID_ID: