Expo Permission PHONE_CALL

南楼画角 提交于 2020-06-17 09:31:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!