Chirag Parmar
Chirag Parmar

Reputation: 1064

How to disable auto open Captive portal in Android marshmallow?

I have work with open ssid of wifi.

when auto wifi connected to ssid that time automatically default browser open and redirect to Captive Portal.

I have find the method ignoreNetwork() in CaptivePortal class in Android library.

Show below link:

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/net/CaptivePortal.java

How can I use ignoreNetwork() method in my project?

How to create instance of CaptivePortal class?

Upvotes: 3

Views: 2466

Answers (1)

drkr
drkr

Reputation: 446

You don't need to create a CaptivePortal class instance. You can disable the Captive Portal Detection by changing Android Settings with adb tool.

Run in your host command prompt:

//Android 4+
adb shell settings put global captive_portal_detection_enabled 0

//Since Android 7
adb shell settings put global captive_portal_mode 0

More details: https://github.com/ukanth/afwall/wiki/FAQ#61-what-is-androids-captive-portal-check

Also, check this answer maybe it helps.

Upvotes: 0

Related Questions