pbakondy / cordova-plugin-sim

:cherries: A cordova plugin to get the device's SIM data (carrier name, mcc mnc, country code, telephonenumber, etc)
MIT License
163 stars 100 forks source link

Cordova Not Available when getting SIM info #82

Closed wolfghoul closed 6 years ago

wolfghoul commented 6 years ago

Expected behaviour

Hope to request permission succesfully and get SIM info.

Actual behaviour

When I try to use getSimInfo and getSimInfo, it always return error: Cordova Not Available. requestReadPermission is not useful as well. Here is my configuration you may want to know: "ionic-native/sim": "^4.7.0", "ionic-native": "^2.2.13", "cordova-plugin-sim": "^1.3.3" And I am sure cordova-plugin-sim is installed in android platform 6.2.3 correctly because I can see Sim.java in com.pbakondy.

I'm seeing this behaviour on

Remove this hint: these checkboxes can be checked like this: [x]

I am using

Hardware models

Huawei Honor V 10

OS versions

Android 8.0.0, and tried with Android 7.0.0 as well

I've checked these

So how can we reproduce this?

corodva 8.0.0 ionic 3.18.0 ionic/cli-plugin-cordova 1.6.2 cordova-android 6.2.3

I put these code in root page right before checking login. And it shows two prompts with "Cordova not available", and one with "Permission denied after opening app. Here is the code:

this.sim.hasReadPermission().then(
        (info) => alert(info),
        (err) => alert(err)
    );
       this.sim.requestReadPermission().then(
      () => alert('Permission granted'),
      () => alert('Permission denied')
    );
       this.sim.getSimInfo().then(
      (info) => alert(info),
      (err) => alert(err)
    );
wolfghoul commented 6 years ago

Fixed

xDaly commented 2 years ago

how did fix it ?