lwinkyawmyat
lwinkyawmyat

Reputation: 1242

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?

Upvotes: 11

Views: 6448

Answers (1)

damusnet
damusnet

Reputation: 4398

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);
    }
}

Upvotes: 16

Related Questions