Get a unique ID for Android devices without any permissions
AndroidID
Java and Kotlin Android library. Uniquely identify an Android device without any permissions and API restrictions. The recommended approach using DRM API.
Implementation
Gradle:
Add it in your root build.gradle at the end of repositories:
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.devEyosiyas:AndroidID:1.0.2'
}
Or Maven:
<div class="highlight highlight-text-xml position-relative" data-snippet-clipboard-copy-content="
jitpack.io
https://jitpack.io
groupId>com.github.devEyosiyas
AndroidID
1.0.2
“>
<repositories> <repository> <id>jitpack.ioid> <url>https://jitpack.iourl> repository> repositories> <dependency>groupId>com.github.devEyosiyasgroupId> <artifactId>AndroidIDartifactId> <version>1.0.2version> dependency>
How do I use Android ID?
Java
String widevine = JavaAndroidID.widevine; // The most reliable way
String commonPSSH = JavaAndroidID.commonPSSH;
String clearKey = JavaAndroidID.clearKey;
String playReady = JavaAndroidID.playReady;
Kotlin
val id = KotlinAndroidID()
val widevine: String = id.widevine() // The most reliable way
val commonPSSH: String = id.commonPSSH()
val clearKey: String = id.clearKey()
val playReady: String = id.playReady()
Author
Eyosiyas Bereketab – @devEyosiyas on GitHub, and @devEyosi on Twitter