简体   繁体   English

Android MediaDrm 唯一 ID

[英]Android MediaDrm unique id

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.我正在通过 ANDROID_ID 跟踪设备,但它会随着出厂重置而改变。 The solution i found to handle factory reset was to use MediaDrm unique id.我发现处理出厂重置的解决方案是使用 MediaDrm 唯一 ID。 This is how i am getting the unique id这就是我获得唯一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 is it's not globally unique (My assumption) because many users are reporting that they can't create account in a newly bought device and when i check logs some other users is already registered with that id. MediaDrm 的问题在于它不是全球唯一的(我的假设),因为许多用户报告说他们无法在新购买的设备中创建帐户,并且当我检查日志时,一些其他用户已经使用该 ID 注册。 My question is, is it globally unique as it is supposed to be or am i doing something wrong while getting it?我的问题是,它是全球独一无二的,还是我在得到它时做错了什么? If it's not globally unique, is there any workaround to handle this issue.如果它不是全球唯一的,是否有任何解决方法来处理此问题。

I have faced the same situation, and I just removed this check.我遇到了同样的情况,我刚刚删除了这个检查。 But I think you can try to concatenate all different UUIDs provided by DRM and then check if these ID's changes after reset factory or not?但我认为您可以尝试连接 DRM 提供的所有不同 UUID,然后检查这些 ID 在重置工厂后是否更改?

You can check this link for reference also: USING MEDIADRM FOR DEVICE ID TRACKING您也可以查看此链接以供参考: 使用 MEDIADRM 进行设备 ID 跟踪

Also, you can share results with us, so anyone needing it in future may get help.此外,您可以与我们分享结果,以便将来需要它的任何人获得帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM