Linking with android os settings in react native

时光总嘲笑我的痴心妄想 提交于 2019-12-17 19:22:14

问题


I'm trying to link with android os settings page.

Going to Phone Dail with Linking is work.

Linking.openURL('tel: +959 XXXXXXXX');

Can I use Linking to link with android os settings page like android location settings page?


回答1:


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.

Here is some example Android code:

public void openWifiSettings() {
    Intent intent = new Intent(Intent.ACTION_WIFI_SETTINGS);
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }
}


来源:https://stackoverflow.com/questions/38893684/linking-with-android-os-settings-in-react-native

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