Configure connectivity checks on Android
آخر تحديث:
This guide explains how users of Android 8 or newer can configure connectivity checks, which are used primarily for captive portal detection. For more information regarding why this might be relevant for you, please check out this blog post.
Prerequisites
First you need to install adb (Android debug bridge) on your computer, and enable it on your Android device. The process varies depending on computer OS and Android device so we suggest to either follow the official documentation or other guides available online, such as the guide by xda-developers.
When you are done changing the settings below, we recommend that you disable adb on your Android device again, to protect it from being accessed by others when you plug it in later. See above links for this also.
How to set the captive portal mode
Connectivity checks are controlled by the captive portal mode, which can be one of the following values:
-
0
- Don’t attempt to detect captive portals. This means connectivity checks are disabled. -
1
- When detecting a captive portal, display a notification that prompts the user to sign in. This is the default setting. -
2
- When detecting a captive portal, immediately disconnect from the network and do not reconnect to that network in the future.
The following command can be used show the current mode:
adb shell settings get global captive_portal_mode
The following command can be used to set the captive portal mode:
adb shell settings put global captive_portal_mode <mode>
So for example, to disable connectivity checks, run the following command:
adb shell settings put global captive_portal_mode 0
How to set a custom captive portal server
If you rather keep the captive portal detection enabled, but want to avoid sending traffic to Google, it is also possible to change which servers are used for captive portal detection. Please note that it might be better or worse in terms of privacy. Less data might be collected, however the traffic might be more identifiable as it is more unique.
These are the commands to run to set custom connectivity check URLs:
adb shell settings put global captive_portal_http_url http://example.com/generate_204 adb shell settings put global captive_portal_https_url https://example.com/generate_204 adb shell settings put global captive_portal_fallback_url http://fallback.example.com/gen_204 adb shell settings put global captive_portal_other_fallback_urls http://fallback.example.com/generate_204