Android Question Android MediaDrm unique id

momin

New Member
I am creating an app where only one person can create one account in one device, He can not create or use another account on that device. I was tracking devices through ANDROID_ID but it changes with factory reset. The solution i found to handle factory reset was to use MediaDrm unique id. This is how I am getting the unique id
Get Unique ID:
public static String getUniqueID() {
    UUID wideVineUuid = new UUID(-0x121074568629b532L, -0x5c37d8232ae2de13L);
    try {
        MediaDrm wvDrm = new MediaDrm(wideVineUuid);
        byte[] wideVineId = wvDrm.getPropertyByteArray(MediaDrm.PROPERTY_DEVICE_UNIQUE_ID);
        return android.util.Base64.encodeToString(wideVineId, Base64.NO_WRAP);
    } catch (Exception e) {
        return null;
    }
 
}

The problem with MediaDrm WideVine is it's NOT globally unique because many users are reporting that they can't create account in a newly bought device and when I checked logs some other user is already registered with that id. My question is, is there any workaround to handle this issue or to get highly reliable unique id in Android.
 
Top