世博会许可 PHONE_CALL

IT技术 reactjs react-native expo
2021-05-14 07:48:01

嗨,我正在尝试使用 expo 应用程序创建本机react,主应用程序的功能是以自动方式调用用户,但我们无法使用 expo 请求 PHONE_CALL 权限!调用任何 Android 权限的最佳方式是什么?

该应用程序仅适用于 Android,但我们不知道如何请求此权限!

谢谢你的帮助!

1个回答

您可以Linking.openURL为此使用

Linking.openURL('tel:123456789');

下面是它的一个例子: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>
  );
}