Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking with android os settings in react native

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?

like image 374
lwinkyawmyat Avatar asked Aug 11 '16 10:08

lwinkyawmyat


People also ask

Can React Native be used for iOS and Android?

React Native enables you to build iOS and Android mobile apps and benefit from code reuse cross platform. React Native is an exciting new language backed by Facebook that allows you to create a native mobile experience on Android and iOS devices through a common coding experience.


1 Answers

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);
    }
}
like image 90
damusnet Avatar answered Jan 01 '23 08:01

damusnet