Closed 1N50MN14 closed 8 years ago
What do you mean "the plugin should not have READ_SMS permission dependency"?
@pbakondy My understanding is that READ_PHONE_STATE
is the only permission required for the plugin to successfully work. For some reason the plugin throws READ_SMS
permission error on Cordova 6.0.0 and Android 6.0.1. This was not the case when I ran the plugin with Cordova 5.4.0, I started seeing this error after upgrading.
OK, I get it. This error message can be misleading.
getLine1Number() method requires permission READ_PHONE_STATE or READ_SMS. The error message references only the second one.
http://developer.android.com/reference/android/telephony/TelephonyManager.html#getLine1Number%28%29
Please upgrade to the latest version of cordova-plugin-sim and test again.
Yup, thank you that did it! The one thing I noticed is the phoneNumber attribute is now missing in the callback object, I'm not sure if this is related to upgrading to Android 6.0.0, in which case isn't it supposed to be an empty string?
3,2,1 slap on my face! I'm usually careful going through README I should've revisited that. Closing issue, thanks for the help ;)
@pbakondy Just found this post by searching on the internet for this issue (not using the repo), and I'd like to correct you: On Android 5.x and below, you must have READ_PHONE_STATE permission to call getLine1Number, but from Android 6.x it seems it needs either READ_PHONE_STATE or READ_SMS. I suggest using only READ_PHONE_STATE, because I don't see any docs about this weird behavior. Also, I've published a post about it here: https://code.google.com/p/android/issues/detail?id=226748
Expected behaviour
This error should not be thrown, plugin should not have READ_SMS permission dependency.
Actual behaviour
getLine1NumberForDisplay: Neither user 10157 nor current process has android.permission.READ_SMS
error is thrown, no sim data returned.I'm seeing this behaviour on
Remove this hint: these checkboxes can be checked like this: [x]
I am using
Hardware models
Nexus 5
OS versions
Android 6.0.1
I've checked these
deviceready
to fire.window.onerror
catches nothing).So how can we reproduce this?
Simply run on Android 6.0.1