react-native-send-intent
react-native-send-intent copied to clipboard
SendIntentAndroid.sendPhoneCall not working for me
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
Thanks for the help and merry xmas!
I have a similar situation
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)
}
}
I'll try, thanks for the help <3