2

Right now my algorithm based only on IMEI. And here is the problem: some devices doesn't have radio module, so they also doesn't have IMEI I need unique parameters ( CPU ID, flash ID, MAC etc) to generate ID without using IMEI. And how to get them with Java. Preferably without Root Thank you

5 Answers 5

3

Use Build.SERIAL to get the unique serial number of an android device. This will return a string value. In emulator this code may return the string "unknown". But try it with a device. It really works... :)

String id=Build.SERIAL;
Sign up to request clarification or add additional context in comments.

2 Comments

this method will not work on API level less than 9(Android 2.2.3)
This serial never changes? Even after factory reset or update OS? Its unique for each device?
2

ANDROID_ID

More specifically, Settings.Secure.ANDROID_ID. This is a 64-bit quantity that is generated and stored when the device first boots. It is reset when the device is wiped.

ANDROID_ID seems a good choice for a unique device identifier. There are downsides: First, it is not 100% reliable on releases of Android prior to 2.2 (“Froyo”). Also, there has been at least one widely-observed bug in a popular handset from a major manufacturer, where every instance has the same ANDROID_ID.

This could help you

Comments

1

You may use android.os.Build.getSerial() instead of android.os.Build.SERIAL

android.os.Build.SERIAL --> This field was deprecated in API level O. Use getSerial() instead. Source: https://developer.android.com/reference/android/os/Build.html

Comments

0

You can use the Setting.secure which is inbuilt to get the device id. this device ID is fixed till you reset the factory setting.

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

This is the unique Id of your device which is stable till you reset to the factory setting.

Comments

-2

below code can help you to get your device id

 String ts = Context.TELEPHONY_SERVICE;
    TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(ts);
    String imsi = mTelephonyMgr.getSubscriberId();
    String imei = mTelephonyMgr.getDeviceId();

1 Comment

My device doesn't have radio module, so getSubscriberId() and getDeviceId() returns NULL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.