cordova-plugin-sim icon indicating copy to clipboard operation
cordova-plugin-sim copied to clipboard

return undefined

Open jeffersonmello opened this issue 9 years ago • 7 comments

in my phone dual sim return undefined for all

`window.plugins.sim.getSimInfo(successCallback, errorCallback);

function successCallback(result) { console.log(result); } VM51:1 Uncaught ReferenceError: errorCallback is not defined(…)(anonymous function) @ VM51:1 function onDeviceReady() { window.plugins.sim.getSimInfo(successCallback, errorCallback); }

function successCallback(result) { console.log(result); }

function errorCallback(error) { console.log(error); } undefined function hasReadPermission() { window.plugins.sim.hasReadPermission(successCallback, errorCallback); } undefined function requestReadPermission() { window.plugins.sim.requestReadPermission(successCallback, errorCallback); } undefined // Android only: request permission function requestReadPermission() { window.plugins.sim.requestReadPermission(successCallback, errorCallback); }

function successCallback(result) { console.log(result); }

function errorCallback(error) { console.log(error); }

undefined`

jeffersonmello avatar Mar 16 '17 19:03 jeffersonmello

i add permision, now return all excepted phonenumber

jeffersonmello avatar Mar 16 '17 20:03 jeffersonmello

I have the same exact problem

jasperltz93 avatar Mar 17 '17 03:03 jasperltz93

I think I've figured out why by looking Johan's answer in this stackoverflow http://stackoverflow.com/questions/2480288/programmatically-obtain-the-phone-number-of-the-android-phone

jasperltz93 avatar Mar 17 '17 03:03 jasperltz93

I managed to resolve, need to add the following permission to android

And also need to grant permission by the user

function requestReadPermission() { window.plugins.sim.requestReadPermission(successCallback, errorCallback); }

Is working fine for min, the problem is phone number that is not returned, as I realized it something of the android itself

jeffersonmello avatar Mar 17 '17 11:03 jeffersonmello

@jeffersonmello I'm using dual sim card too and I'm able to get the phoneNumber after entering the SIM card number at sim card setting.

Go to your phone setting -> SIM -> select your SIM card ->edit SIM card number

mizannoor avatar Apr 24 '17 11:04 mizannoor

@mexists Interesting I'll test this method

jeffersonmello avatar Apr 24 '17 11:04 jeffersonmello

I am using dual sim, not able to able to get the phone number, Anybody help me how to add permissions to get phone number from real device?

BalaMC avatar Nov 09 '17 06:11 BalaMC