Mac 可以通過 Homebrew 完成修改驗證服務器的操作。

此命令支持 Android 10.x/9.x/8.x/7.x

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew cask install android-platform-tools
adb devices
adb shell settings put global captive_portal_detection_enabled 1
adb shell settings put global captive_portal_mode 1
adb shell settings put global captive_portal_use_https 0
adb shell settings put global captive_portal_server via.moe
adb shell settings put global captive_portal_http_url http://via.moe/generate_204
adb shell settings put global captive_portal_https_url https://via.moe/generate_204

其他操作系統自行手動安裝對應平台 Google 的 SDK Platform Tools

設置參數:

captive_portal_detection_enabled: 5.0 ~ 7.1.1

  • Setting to turn off captive portal detection. Feature is enabled by default and the setting needs to be set to 0 to disable it.

captive_portal_mode: 7.1.2 ~

  • 0: CAPTIVE_PORTAL_MODE_IGNORE Don’t attempt to detect captive portals.
  • 1: CAPTIVE_PORTAL_MODE_PROMPT When detecting a captive portal, display a notification that prompts the user to sign in.
  • 2: CAPTIVE_PORTAL_MODE_AVOID When detecting a captive portal, immediately disconnect from the network and do not reconnect to that network in the future.

captive_portal_use_https: 7.0 ~

  • Whether to use HTTPS for network validation. This is enabled by default and the setting needs to be set to 0 to disable it. This setting is a misnomer because captive portals don’t actually use HTTPS, but it’s consistent with the other settings.

captive_portal_server: 5.0 ~ 7.1.0

  • The server used for captive portal detection upon a new conection. A 204 response code from the server is used for validation.

captive_portal_http_url: 7.1.1 ~

  • The URL used for HTTP captive portal detection upon a new connection. A 204 response code from the server is used for validation.

captive_portal_https_url: 7.1.1 ~

  • The URL used for HTTPS captive portal detection upon a new connection. A 204 response code from the server is used for validation.

captive_portal_fallback_url: 7.1.1 ~

  • The URL used for fallback HTTP captive portal detection when previous HTTP and HTTPS captive portal detection attemps did not return a conclusive answer.

captive_portal_user_agent: 7.1.1 ~

  • Which User-Agent string to use in the header of the captive portal detection probes. The User-Agent field is unset when this setting has no value (HttpUrlConnection default).

本文參考:

關於 Android 5.0-7.1.1 網絡圖標上的感嘆號及其解決辦法

orzFly’s Knowledge Base