Reputation: 895
I want to generate android device unique id for my android application to create favourite according to user device udid.
Upvotes: 7
Views: 30598
Reputation: 11
You can use different values as udid. The above mentioned Secure.ANDROID_ID has some cons It can be null It is same on 2.2 and some 4.2 devices You can use MacAddress of device or IMIE address(Can be null on devices without cellular connection)
Upvotes: 0
Reputation: 2392
private String uDiD = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
Upvotes: 0
Reputation: 1545
All devices have a unique id.
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
Upvotes: 19