我知道我们可以使用IntentLauncherAndroid
我当前的代码如下:
import { IntentLauncherAndroid as IntentLauncher } from 'expo';
// onClick function to access app's permission settings
onPressButton = () => {
IntentLauncher.startActivityAsync(IntentLauncher.ACTION_SETTINGS)
}
虽然目前该按钮仅打开手机的常规设置。
答案 0 :(得分:0)
此代码应该是您想要的,您可以使用Intent Promise来了解用户何时从Intent操作(https://docs.expo.io/versions/latest/sdk/intent-launcher/#returns)中回来
import { IntentLauncherAndroid as IntentLauncher } from 'expo';
// onClick function to access app's permission settings
onPressButton = async () => {
const intent = await IntentLauncher.startActivityAsync(
IntentLauncher.ACTION_LOCATION_SOURCE_SETTINGS
)
}