wumke / react-native-immediate-phone-call

Initiate immediate phone call (without further user interaction) for React Native on iOS and Android.
GNU General Public License v3.0
174 stars 51 forks source link

Permission Denial #16

Closed devthejo closed 6 years ago

devthejo commented 6 years ago

Hello, I have this bug on android sdk 27 with react-native 0.57

Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxx flg=0x10000000 cmp=com.android.server.telecom/.components.UserCallActivity } from ProcessRecord{c5b7094 24276:com.alertesecours/u0a84} (pid=24276, uid=10084) with revoked permission android.permission.CALL_PHONE
readException
    Parcel.java:1684
readException
    Parcel.java:1637
startActivity
    ActivityManagerNative.java:3101
execStartActivity
    Instrumentation.java:1518
startActivity
    ContextImpl.java:791
startActivity
    ContextImpl.java:768
startActivity
    ContextWrapper.java:356
startActivity
    ContextWrapper.java:356
immediatePhoneCall
    RNImmediatePhoneCallModule.java:40
invoke
    Method.java
invoke
    JavaMethodWrapper.java:372
invoke
    JavaModuleWrapper.java:160
run
    NativeRunnable.java
handleCallback
    Handler.java:751
dispatchMessage
    Handler.java:95
dispatchMessage
    MessageQueueThreadHandler.java:29
loop
    Looper.java:154
run
    MessageQueueThreadImpl.java:192
run
    Thread.java:761

this article https://stackoverflow.com/questions/33473436/revoked-permission-android-permission-call-phone/33473478 seem to tell us the way to solve it, but I wondered if we can't include it directly in react-native-immediate-phone-call

wumke commented 6 years ago

Indeed this would be a great addition! Feel free to help and send a pull request... I'm very busy and have no time to implement it myself at the moment :-(

souvik-ghosh commented 6 years ago

facing the same problem : ( @takion did you work it out?

devthejo commented 6 years ago

@souvik-ghosh I used react-native-permissions to ensure user have permission, or request for it, before calling react-native-immediate-phone-call, preferably on application start

wumke commented 6 years ago

I think this is the best option (I use it myself for other permissions). This ensures separation between permissions and logic, which might be good for future changes.

React native also has PermissionsAndroid which you can use to check and ask for permission, so external packages are not needed if you don't want to...

anniewey commented 1 year ago

hi @wumke, just to clarify. so we only need to check permission for android is it? what bout ios? if user denied, will the permission dialog prompted again? since i cant test in simulator.

Android: PERMISSIONS.ANDROID.CALL_PHONE iOS: needed?

https://github.com/zoontek/react-native-permissions#supported-permissions