Android - unique and constant device ID

Milad Nouri

I need to register user devices on server with an unique identifier that be a constant value and doesn't change in the future.

I can't find a good solution to get unique id from all devices (with/without simcard).

Secure.ANDROID_ID: Secure.ANDROID_ID is not unique and can be null or change on factory reset.

String m_androidId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);

IMEI: IMEI is dependent on the Simcard slot of the device, so it is not possible to get the IMEI for the devices that do not use Simcard.

TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String uuid = tManager.getDeviceId();

WLAN MAC Address: If device doesn’t have wifi hardware then it returns null MAC address. and user can change the device mac address.

WifiManager m_wm = (WifiManager)getSystemService(Context.WIFI_SERVICE); 
String m_wlanMacAdd = m_wm.getConnectionInfo().getMacAddress();

Bluetooth Address string:If device hasn’t bluetooth hardware then it returns null.

BluetoothAdapter m_BluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); 
String m_bluetoothAdd = m_BluetoothAdapter.getAddress();

Instance id: instance_id will change when user uninstalls and reinstalls app. and it's not a constant value.

Do you have any idea to get a unique id from all Android devices (with/without simcard, Bluetooth, ...) that really be unique, cannot be null and doesn't change after uninstall/reinstall app?

Milad Nouri

I found that Secure.ANDROID_ID is the best choice. This is a 64-bit quantity that is generated and stored when the device first boots. But it resets on device factory reset.

there are some reports that shows some devices has same Secure.ANDROID_ID on all instances.

we can add extra items (like sim serial, GCM instance id or ...) to the Secure.ANDROID_ID and generate new unique fingerprint.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Is there a unique Android device ID?

From Java

How to get unique device hardware id in Android?

From Dev

Is there a unique boot session id or count on an android device?

From Dev

how to reach android device unique id?

From Dev

Unique ID for a device with PHP

From Dev

Is there a unique windows device id?

From Dev

Unique ID of storage device

From Dev

unique ID for every Device

From Dev

Unique, but constant identification of mobile device through PHP

From Dev

Generate unique id for each device

From Dev

Get unique device ID in QML

From Dev

Perfect unique_id for device except IMEI,Android_ID,WLAN Mac and Bluetooth address

From Dev

Build Number of Android device is unique or not?

From Dev

PushSharp Device ID for Android

From Dev

Android ID as an alternative to Device ID

From Dev

How to send a Notification for particular Android device by unique id via GCM by Windows Azure?

From Java

How to get a unique device ID in Swift?

From Dev

Get unique device id for amazon echo

From Dev

How to get unique id in iOS device?

From Dev

Device Unique id in Windows Phone 8.1

From Dev

Why did my unique device ID change?

From Dev

When is device unique id the same on windows phone?

From Dev

Know push id of android device

From Dev

Can an emulator have a unique device ID? And can you use that ID?

From Dev

Get the index of an element given a constant class and unique id

From Dev

how to change device id (android id) programmatically

From Dev

Setting Unique Id to ListView Android

From Java

Generate int unique id as android notification id

From Dev

How to get device phone number or unique id in Swift?

Related Related

HotTag

Archive