Jun*_*tae 7 react-native react-native-ios
我想从我的应用程序打开ios设置应用程序.设置目的地是[settings => notification => myapp].打开和关闭推送通知.
有一些关于如何链接到设置的文档,但我不知道如何打开深层链接.(notification => myapp).
我怎样才能做到这一点?
Aru*_*mar 22
您可以深入链接引用设置的索引,如下所示:
Linking.openURL('app-settings:')
Run Code Online (Sandbox Code Playgroud)
以上方法仅适用于IOS
B. *_*mad 16
由于 React Native 0.60 打开 App 设置使用:
import { Linking } from 'react-native';
Linking.openSettings();
Run Code Online (Sandbox Code Playgroud)
打开设置应用程序并显示应用程序的自定义设置(如果有)。
适用于 Android 和 iOS
对于 iOS 14,这就是我打开位置服务设置的方式
Linking.openURL('App-Prefs:Privacy&path=LOCATION')
Run Code Online (Sandbox Code Playgroud)
在本机反应 0.63.4 中测试
使用Linking.openURL。例如,下面是如何在iOS上检查并打开Health应用程序
import { Linking } from 'react-native'
async goToSettings() {
const healthAppUrl = 'x-apple-health://'
const canOpenHealthApp = await Linking.canOpenURL(healthAppUrl)
if (canOpenHealthApp) {
Linking.openURL(healthAppUrl)
} else {
Linking.openURL('app-settings:')
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11973 次 |
| 最近记录: |