diff --git a/android/src/main/java/com/reactlibrary/rnwifi/RNWifiModule.java b/android/src/main/java/com/reactlibrary/rnwifi/RNWifiModule.java index 735ff04c..f2e2740b 100644 --- a/android/src/main/java/com/reactlibrary/rnwifi/RNWifiModule.java +++ b/android/src/main/java/com/reactlibrary/rnwifi/RNWifiModule.java @@ -186,7 +186,22 @@ public void isEnabled(final Promise promise) { */ @ReactMethod public void setEnabled(final boolean enabled) { - wifi.setWifiEnabled(enabled); + if (isAndroidTenOrLater()) { + openWifiSettings(); + } else { + wifi.setWifiEnabled(enabled); + } + } + + /** + * Use this to open a wifi settings panel. + * For Android Q and above. + */ + @ReactMethod + public void openWifiSettings() { + Intent intent = new Intent(Settings.Panel.ACTION_WIFI); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + this.context.startActivity(intent); } /**