android_id should uniquely identify the device, however, it was noted that the identifier can be changed if you know how Spoofing android_id
import android.provider.Settings.System; String android_id = System.getString(this.getContentResolver(), System.ANDROID_ID);
In the emulator, android_id does not matter, so you will need to put a debugging procedure to assign the value yourself.
However, if you want to identify the user and allow the user to access your service from different devices with the same user ID, you better assign them a user ID and authenticate them for your service using this user ID as their credentials. This will allow them use your identifier on different devices, if you did not use it in combination with android_id (and android_id not tampered with), then you can limit them to one device.
dar
source share