You can read the serial number of the device. It’s not imei
This was discussed in your previous post Carlos Deviceid function of the phone manager extension no longer returns the id - #2 by jis
It is not possible on devices higher than Android 9 to use an extension like the Phone Manager extension to get the device id (or possibly any device at all), probably due to Google's latest security protections.
Carlos_Andre:
I need to read the serial number.
it is unfortunately not possible anymore starting from Android 10
Taifun
see here why this is not possible anymore in Android 10
https://developer.android.com/about/versions/10/privacy/changes
Taifun
Restriction on non-resettable device identifiers
Starting in Android 10, apps must have the READ_PRIVILEGED_PHONE_STATE
privileged permission in order to access the device’s non-resettable identifiers, which include both IMEI and serial number.
Caution: Third-party apps installed from the Google Play Store cannot declare privileged permissions.
Affected methods include the following:
-
Build
-
TelephonyManager
If your app doesn’t have the permission and you try asking for information about non-resettable identifiers anyway, the platform’s response varies based on target SDK version:
- If your app targets Android 10 or higher, a
SecurityException
occurs. - If your app targets Android 9 (API level 28) or lower, the method returns
null
or placeholder data if the app has theREAD_PHONE_STATE
permission. Otherwise, aSecurityException
occurs.