Android captive portal
Last updated : 17/1/2023
Introduction
This is my guide on configuring connectivity checks on Android cellphones, based off Mullvad's guide with some changes to accomodate rooted users as well.
Prerequisites
Required stuff :
- An Android device (cellphone / tablet) with either USB debugging enabled or Magisk installed
- For USB debugging approach (recommended regardless of root access)
- A computer with adb installed
- A USB cable to connect Android device & computer
- Termux / any latest Android terminal emulator that can use root (for Magisk approach - usable without computer, but less recommended - for example, Termux is rather shaky with >=A12)
Preparation guide (USB debugging) :
- Open terminal in computer
- Ensure Android device has USB debugging enabled by entering Developer options
- Connect computer & Android device
- Grant computer adb shell access with the command:
adb shell
Alternatively, when adb shell access is only required for each command, insert adb shell before inserting command.
Preparation guide (rooted) :
- Ensure Android device has Magisk installed (both the Magisk-patched image & Magisk apk)
- Install & open terminal emulator app
- Type su in terminal & grant the terminal app root access when prompted
The prompt will not appear if Magisk apk is not installed, even if Magisk is already flashed.
Captive portal mode
Captive portal mode values :
- 0 : Disables captive portal / don't attempt to detect captive portals.
- 1 : Default settings; displays a notification for sign-in prompt whenever captive portal is detected.
- 2 : Automatically disconnects from network & no longer auto-reconnect to it whenever captive portal is detected.
To show current captive portal mode :
settings get global captive_portal_mode
To change current captive portal mode :
settings put global captive_portal_mode [mode]
Captive portal server
For those who'd like to use captive portal, first read the captive portal provider list for more information on which captive portal servers I would recommend. Then, use these commands:
- settings put global captive_portal_http_url (your preferred captive portal provider's HTTP URL)
- settings put global captive_portal_https_url (your preferred captive portal provider's HTTPS URL)
- settings put global captive_portal_fallback_url (your preferred captive portal provider's fallback URL, or their HTTP/HTTPS URL)
- settings put global captive_portal_other_fallback_urls (your preferred captive portal provider's other fallback URL, or their HTTP/HTTPS URL)
- reboot
To verify captive portal url changes :
- settings get global captive_portal_http_url (or, replace http_url with either https_url, fallback_url, or other_fallback_urls; depending on which one you'd like to check)
- Exit shell with exit command, no reboot necessary
Back to top
Index - cellphone
Main Page