react-native-send-intent icon indicating copy to clipboard operation
react-native-send-intent copied to clipboard

SendIntentAndroid.sendPhoneCall not working for me

Open ayozebarrera opened this issue 6 years ago • 3 comments

Hi, gj by the way!

I need to call to a number without exiting my app and if I use SendIntentAndroid.sendPhoneCall('+55 48 9999-9999'); it shows up the phone dial, and If I add the 2nd parameter SendIntentAndroid.sendPhoneCall('+55 48 9999-9999', true); nothing happens... what am I doing wrong?

I added the on AndroidManifest.xml

Thanks for the help and merry xmas!

ayozebarrera avatar Dec 28 '18 08:12 ayozebarrera

I have a similar situation

huunghi20061997 avatar Dec 29 '18 16:12 huunghi20061997

Hi @ayozebarrera and @huunghi20061997

Maybe your Android API it's too high (and modern) so you need to ask the permission in runtime (besides the permission added in AndroidManifest.xml).

You could do something like that width https://facebook.github.io/react-native/docs/permissionsandroid:

async function requestCallPhone() {
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.CALL_PHONE, {
        'title': 'App Call Phone Permission',
        'message': 'App needs access to your call phone feature'
      }
    )
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      SendIntentAndroid.sendPhoneCall('+55 48 9999-9999', true);
    } else {
      console.log("Call Phone permission denied")
    }
  } catch (err) {
    console.warn(err)
  }
}

lucasferreira avatar Dec 31 '18 14:12 lucasferreira

I'll try, thanks for the help <3

ayozebarrera avatar Jan 08 '19 14:01 ayozebarrera