cordova-plugin-sim
cordova-plugin-sim copied to clipboard
The user 10412 does not meet the requirements to access device identifiers.
Android I have already given the permission but still not getting SIM info.
result: Unable to get sim info: The user 10412 does not meet the requirements to access device identifiers."
this.sim.getSimInfo().then(
(info) => console.log('Sim info: ', info),
(err) => console.log('Unable to get sim info: ', err)
);
Getting the same for me. It mostly started coming after requesting permission. But without permission, not getting complete details of the sim.
I also had the same problem on android 10
I think this issue is linked to a new privacy policy on android 10. If I well understood, they restrict access to non resetable device property to applications that grant the READ_PRIVILEGED_PHONE_STATE permission. And this permission is only for System Applications.
There is more detail THERE
Methods that require this privilege are :
Build::getSerial()
TelephonyManager::getImei()
TelephonyManager::getDeviceId()
TelephonyManager::getMeid()
TelephonyManager::getSimSerialNumber()
TelephonyManager::getSubscriberId()
And in this plugin, getDeviceId, getSimSerialNumber and getDeviceId are used.
So I guess that with Android > 10, these informations will not be available for a non system application.
I think this issue is linked to a new privacy policy on android 10. If I well understood, they restrict access to non resetable device property to applications that grant the READ_PRIVILEGED_PHONE_STATE permission. And this permission is only for System Applications.
There is more detail THERE
Methods that require this privilege are :
Build::getSerial() TelephonyManager::getImei() TelephonyManager::getDeviceId() TelephonyManager::getMeid() TelephonyManager::getSimSerialNumber() TelephonyManager::getSubscriberId()
And in this plugin, getDeviceId, getSimSerialNumber and getDeviceId are used.
So I guess that with Android > 10, these informations will not be available for a non system application.
what the solution for this?
@Ashclan : For me the solution is to modify this plugin. The modification must check for android version. if version is > 10, then the plugin should not call methods that require privilege and return a JSON result without informations that can't be retrieved now.
Personally, I encounter this problem on a small application I do on my free time, so I didn't spent time on doing this patch. I just need the user phone number, and I prefer to add a small form asking user to enter it's phone number rather than modifying this plugin... I don't really like to do Java on my freetime (even a little bit !) :smile: