cordova-plugin-sim icon indicating copy to clipboard operation
cordova-plugin-sim copied to clipboard

The user 10412 does not meet the requirements to access device identifiers.

Open Polyscripts-Aashay opened this issue 4 years ago • 5 comments

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)
);

Polyscripts-Aashay avatar Dec 06 '20 08:12 Polyscripts-Aashay

Getting the same for me. It mostly started coming after requesting permission. But without permission, not getting complete details of the sim.

hrpatidar avatar Dec 21 '20 01:12 hrpatidar

I also had the same problem on android 10

dodysat avatar Feb 07 '21 20:02 dodysat

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.

adrienbarral avatar Mar 17 '21 10:03 adrienbarral

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 avatar Mar 30 '21 11:03 Ashclan

@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:

adrienbarral avatar Apr 01 '21 14:04 adrienbarral