在 React Native 中链接 android os 设置 [英] Linking with android os settings in react native
本文介绍了在 React Native 中链接 android os 设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试链接 android os settings
页面.
I'm trying to link with android os settings
page.
使用 Linking
转到 Phone Dail
是可行的.
Going to Phone Dail
with Linking
is work.
Linking.openURL('tel: +959 XXXXXXXX');
我可以使用Linking
链接到android os settings
页面,比如android location settings
页面吗?
Can I use Linking
to link with android os settings
page like android location settings
page?
推荐答案
Linking.openURL
只能打开格式正确的 url.android 设置没有标准化的网址.您必须编写一些本机代码来执行此操作,然后构建一个 响应本机模块以触发它.
Linking.openURL
can only open correctly formatted urls. There are no standardized urls for the android settings. You would have to write some native code to do this, and then build a React Native Module to trigger it.
以下是一些示例 Android 代码:
Here is some example Android code:
public void openWifiSettings() {
Intent intent = new Intent(Intent.ACTION_WIFI_SETTINGS);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
这篇关于在 React Native 中链接 android os 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文