问题
Hi i am trying to create a react native with expo app the main app's function is call users in an automatic way but we are not able to request PHONE_CALL permission using expo! what is the best way to call any Android permission?
The app is only Android but we don´t know how to request this permission!
Thanks for your help!
回答1:
You can use Linking.openURL for this:
Linking.openURL('tel:123456789');
Here is an example of it in action: https://snack.expo.io/@notbrent/ashamed-churros
import * as React from 'react';
import { Linking, Text, View } from 'react-native';
export default function App() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text
onPress={() => {
Linking.openURL('tel:50000000');
}}>
Call some phone
</Text>
</View>
);
}
来源:https://stackoverflow.com/questions/60347357/expo-permission-phone-call