【问题标题】:How to disable auto open Captive portal in Android marshmallow?如何在 Android marshmallow 中禁用自动打开 Captive 门户?
【发布时间】:2016-09-01 05:12:09
【问题描述】:

我在使用开放 ssid 的 wifi。

当自动 wifi 连接到 ssid 时,默认浏览器会自动打开并重定向到 Captive Portal。

我在 Android 库的 CaptivePortal 类中找到了方法 ignoreNetwork()

显示以下链接:

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

如何在我的项目中使用 ignoreNetwork() 方法?

如何创建 CaptivePortal 类的实例?

【问题讨论】:

    标签: android captivenetwork captiveportal


    【解决方案1】:

    您不需要创建 CaptivePortal 类实例。 您可以通过使用 adb 工具更改 Android 设置来禁用强制门户检测。

    在主机命令提示符下运行:

    //Android 4+
    adb shell settings put global captive_portal_detection_enabled 0
    
    //Since Android 7
    adb shell settings put global captive_portal_mode 0
    

    更多详情:https://github.com/ukanth/afwall/wiki/FAQ#61-what-is-androids-captive-portal-check

    另外,请检查this answer 可能会有所帮助。

    【讨论】:

      猜你喜欢
      • 2014-10-31
      • 2013-07-28
      • 2018-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多