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

PhoneNumber field is empty #50

Closed jarekskuder closed 7 years ago

jarekskuder commented 7 years ago

I made this SIM info request:

function hasReadPermission() { window.plugins.sim.hasReadPermission(function (data) { console.log(data); window.plugins.sim.requestReadPermission(function (data) { console.log(data); window.plugins.sim.getSimInfo(function (data) { console.log(data); }, function (error) { console.log(error); }); }, function (error) { console.log(error); }); }, function (error) { console.log(error); }); }

I get this SIM info object:

activeSubscriptionInfoCount:1 activeSubscriptionInfoCountMax:1 callState:0 cards:Array[1] carrierName:"Tele2" countryCode:"lt" dataActivity:0 deviceId:"355609067436393" deviceSoftwareVersion:"61" isNetworkRoaming:false mcc:"246" mnc:"03" networkType:10 phoneCount:1 phoneNumber:"" phoneType:1 simSerialNumber:"89370036211102443399" simState:5 subscriberId:"246037021380784"

As you can see phoneNumber field is empty. I really cant undestand why? I requested permissions, so it shold work right?

pbakondy commented 7 years ago

It is empty sometimes. Read the README page

jarekskuder commented 7 years ago

Ok, i'm sorry for that, i didn't read enough articles about this. After some research i found out that if plugin gets phone number from device (Settings->aboutphone->sim->phonenumber) then it's sometimes is blank (my is). But i think this plugin takes sim info directly, but again, after research i found out that some sim's doesn't store phoneNumber or operators don't allow it.

So the question is - do we have some walk around? Or for cordova users this is the end of a line?(alto i don't know if there will be much difference in native...)

pbakondy commented 7 years ago

There is no workaround. There is no difference between this cordova plugin or a native implementation.

jarekskuder commented 7 years ago

Ok thx