pbakondy/cordova-plugin-sim

Cordova Not Available when getting SIM info

Closed this issue · 2 comments

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]

  • iOS device
  • iOS simulator
  • Android device:
  • Android emulator

I am using

  • cordova
  • ionic
  • PhoneGap
  • PhoneGap Developer App
  • Intel XDK
  • Intel App Preview
  • Telerik
  • Other:

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

  • It happens on a fresh Cordova CLI project as well.
  • I'm waiting for deviceready to fire.
  • My JavaScript has no errors (window.onerror catches nothing).
  • I'm using the latest cordova library, Android SDK, Xcode, etc.

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

Fixed

xDaly commented

how did fix it ?