![]() Instead of the Kotlin function toHexString (which has no one-line counterpart in Java) I am using Arrays.toString.The only drawback of not hashing the UUID is that you don't have a fixed length UUID, which I don't care about in my application. Moreover, the MessageDigest.update() method applies the SHA-256 hash function to its argument, which introduces an extremely low probability of losing UUID uniqueness. I am not using the MessageDigest, which results in a simpler code.Use ARM on Android P platform or higher, where MediaDrm has the close() method Close resources with close() or release() depending on platform API MediaDrm wvDrm = new MediaDrm(wideVineUuid) īyte wideVineId = wvDrm.getPropertyByteArray(MediaDrm.PROPERTY_DEVICE_UNIQUE_ID) Extensively tested on Android 10 (API 29), Android 11 (API 30) and previous versions.Converted Sofien's code to Java and further simplified.If (AndroidPlatformUtils.isAndroidTargetPieAndHigher()) įor Java users that are interested in Sofien's solution, I have: Val md = MessageDigest.getInstance("SHA-256") ![]() ![]() ![]() Val widevineId = wvDrm.getPropertyByteArray(MediaDrm.PROPERTY_DEVICE_UNIQUE_ID) * Widevine is supported on Android devices running Android 4.3 (API Level 18) and up. Here is the couple of code how can we retreive the unique identifier on Android 10 : import Which contains a unique device id and can survive even on the factory reset and doesn't need any additional permission on your manifest file. I advice you to read the official blog of the best practice of google to see what the use case match with your specification : įor me i occcured the same problem about the unicity of android identifiers and i found the only solution is to use the MediaDrm API ( ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |