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 101 forks source link

requestReadPermission #73

Open fabianglace opened 6 years ago

fabianglace commented 6 years ago

Expected behaviour

requestReadPermission does not ask for permissions in android. Once permissions is given manually then sim info can be gotten.

Actual behaviour

nothing

I'm seeing this behaviour on

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

I am using

Hardware models

Samsung

OS versions

Android 5.2.2

I've checked these

So how can we reproduce this?

Provide the used components versions (cordova, ionic, etc).

Provide the steps to reproduce the issue.

Provide files, sources if available.

pbakondy commented 6 years ago

This is the expected behavior. Once the app receives permission it will not request again.

fabianglace commented 6 years ago

When installed for the first time, it does not ask for permissions. Even after using it as proposed...only if I set the permissions manually. does it get the sim information...In other words requestReadPermission() does not fire up when it should...

fabianglace commented 6 years ago

I'm using android 6 (read_phone_state) which you mentioned does not work in the plugin if it was meant to.

fabianglace commented 6 years ago

window.plugins.sim.hasReadPermission(simPermission, requestSimPermission);

function simPermission(){ readSimCard(); }

function requestSimPermission(){
window.plugins.sim.requestReadPermission(readSimCard, noSimPermission); }

fabianglace commented 6 years ago

I realize when making other permission request the sim request is skipped. I am now getting the request when set to first call...