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

Returned Obj missing keys. #38

Closed rolinger closed 8 years ago

rolinger commented 8 years ago

Expected behaviour

Returned object is missing fields. Plugin docs state the return object should also have these keys - whether the values can be extracted or not (I think) is a different issue. but i should at least see the entire Object (as stated in the docs) correct?

  "phoneNumber": "",
  "deviceId": "",
  "simSerialNumber": "",
  "subscriberId": "",

Actual behaviour

My result object is as follows, though it is returning carrierName, seems the actual carrier can't be extracted from my phone.

Object {
   callState:0
   carrierName:""
   countryCode:"us"
   dataActivity:0
   isNetworkRoaming:false
   mcc:"310"
   mnc:"260"
   networkType:13
   phoneCount:1
   phoneType:1
   simState:5
}

I'm seeing this behaviour on

Samsung Galaxy 5S

OS versions

Android 6

I've checked these

Provide the used components versions (cordova, ionic, etc). Cordova 6.0 Ionic 1.7.14 (intentionally not upgrading to 2.0 yet) cordova-plugin-sim 1.3.0

Provide the steps to reproduce the issue.

Provide files, sources if available.

pbakondy commented 8 years ago

Check permissions https://github.com/pbakondy/cordova-plugin-sim#android-60-permissions

rolinger commented 8 years ago

yup...it was a permissions issue. got it resolved. Last question: is there away to set sim permissions in the config.xml/AndroidManifest.xml file? I am using the cordova-plugin-diagnostics to add a bunch of permission for device settings but don't readily see an option for accessing the sim.

ie:

    <config-file target="AndroidManifest.xml" parent="/*">
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    </config-file>
pbakondy commented 8 years ago

Sure, check this: https://github.com/pbakondy/cordova-plugin-sim/blob/master/plugin.xml#L31

rolinger commented 8 years ago

sweet....great plugin. and excellent support for it. much appreciated.