allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
...
def latestVersion = "1.0.5"
implementation "com.github.memishood:Android-Device-ID:$latestVersion"
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="yourpackage">
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application>
...
</application>
</manifest>
Remember to check READ_PHONE_STATE permission before using
val deviceInfo = DeviceInfo(this)
deviceInfo.imei?.let { imei ->
// your code..
}
deviceInfo.simSerialNumber?.let { simSerialNumber ->
// your code..
}
deviceInfo.secureId?.let { secureId ->
// your code..
}