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

Question about Android/Ios results #46

Closed one-geek closed 7 years ago

one-geek commented 7 years ago

Hi,

Expected behaviour

How could i get the 'phoneNumber' key output for iphone also?

Actual behaviour

When i execute this window.plugins.sim.getSimInfo(...)

function getSimInfo() {
    window.plugins.sim.getSimInfo(
    function (result) {
        console.log(JSON.stringify(result));
    },
    function (error) {
        console.log(error);
    });
}

// The android output is
{
  "carrierName": "",
  "countryCode": "",
  "mcc": "",
  "mnc": ""
}

// the iOs output is 
{
  "carrierName": "",
  "countryCode": "",
  "mcc": "",
  "mnc": "",
  "allowsVOIP": false
}

Then when i Add :

requestReadPermission() for android only

before executing window.plugins.sim.getSimInfo(...). Then, i have a more rich result with the phoneNumber key inside.

But, the iphone still the same static output. Do we need a permission for IOS to get the phoneNumber?

I'm seeing this behaviour on

I am using

Hardware models

Example: Nexus 5, Nexus 5X, iPhone 6s

OS versions

Example: Android 6, Android 7.1.1 and iOS 10.1

I've checked these

-[x]_ It happens on a fresh Cordova CLI project as well.

So how can we reproduce this?

build your app

module.run(function ($ionicPlatform) {
    $ionicPlatform.ready(function () {
    window.plugins.sim.getSimInfo(
    function (result) {
        console.log(JSON.stringify(result));
    },
    function (error) {
        console.log(error);
    });
    });
});
pbakondy commented 7 years ago

it is not supported by Apple

On 13 Dec 2016 22:17, "guerson" notifications@github.com wrote:

Hi, Expected behaviour

How could i get the 'phoneNumber' key output for iphone also? Actual behaviour

When i execute this window.plugins.sim.getSimInfo(...)

function getSimInfo() { window.plugins.sim.getSimInfo( function (result) { console.log(JSON.stringify(result)); }, function (error) { console.log(error); }); }

// The android output is { "carrierName": "", "countryCode": "", "mcc": "", "mnc": "" }

// the iOs output is { "carrierName": "", "countryCode": "", "mcc": "", "mnc": "", "allowsVOIP": false }

Then when i Add :

requestReadPermission() for android only

before executing window.plugins.sim.getSimInfo(...). Then, i have a more rich result with the phoneNumber key inside.

But, the iphone still the same static output. Do we need a permission for IOS to get the phoneNumber? I'm seeing this behaviour on

  • [x]_ iOS device
  • iOS simulator
  • [x]_ Android device
  • Android emulator

I am using

  • [x]_ cordova
  • [x]_ ionic
  • [x]_ PhoneGap
  • PhoneGap Developer App
  • Intel XDK
  • Intel App Preview
  • Telerik
  • Other:

Hardware models

Example: Nexus 5, Nexus 5X, iPhone 6s OS versions

Example: Android 6, Android 7.1.1 and iOS 10.1 I've checked these

-[x]_ 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).
  • [x]_ I'm using the latest cordova library, Android SDK, Xcode, etc.

So how can we reproduce this?

build your app

module.run(function ($ionicPlatform) { $ionicPlatform.ready(function () { window.plugins.sim.getSimInfo( function (result) { console.log(JSON.stringify(result)); }, function (error) { console.log(error); }); }); });

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pbakondy/cordova-plugin-sim/issues/46, or mute the thread https://github.com/notifications/unsubscribe-auth/AAej2d3HNGj7mL6dQL-fb7ePvGHB7GdEks5rHwtYgaJpZM4LMPHt .