update android version 10
device tool not working for getting IMEI number
update android version 10
device tool not working for getting IMEI number
Android has added restrictions on who can access the non-resettable device identifiers such as the IMEI number starting from Android 10 and limited the apps that can use it to the apps that have the READ_PRIVILEGED_PHONE_STATE
permission which isn’t available for non-platform apps If try to access any of these identifiers a security exception occurs. On Android 10 and hiegher, so unfortunately, there is no way to get the IMEI on Android 10 and hiegher unless your app is a platform app
See also here , there has been many topics about this as well for example and this
However, it you shouldn’t collect your users IMEI address any way.
Blocks for what?
If you just want to get a unique id, then you can generate one random string and save to tinybd, and read from tinydb everytime.
If you want to get the same id even if you re install the app, you may save the string in a file on sdcard.
You can name the file name start with a dot, that will make the file invisible, unless the phone is rooted.
Use device serial number
Permanent and unique
You can have a try:
http://www.kevinkun.cn/tools.html
This need write external storage permission.
you can use device ID