Android captive portal

Last updated : 16/8/2023

- Introduction -

- Prerequisites -
Captive portal mode | Captive portal server

- GUI-based solutions -

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 :

Preparation guide (USB debug) :

  1. Open terminal in computer
  2. Ensure Android device has USB debugging enabled by entering Developer options
  3. Connect computer & Android device
  4. Grant computer adb shell access with the command:
  5. adb shell

    Alternatively, when adb shell access is only required for each command, insert adb shell before inserting command.

Preparation guide (Magisk / terminal emulator) :

  1. Ensure Android device has Magisk installed (both the Magisk-patched image & Magisk apk)
  2. Install & open terminal emulator app
  3. Type su in terminal & grant the terminal app root access when prompted
  4. The prompt will not appear if the full Magisk app is not yet installed, even if Magisk is already flashed.

Captive portal mode

Captive portal mode values :

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 to use. Then, use these commands:

  1. settings put global captive_portal_http_url (your preferred captive portal provider's HTTP URL)
  2. settings put global captive_portal_https_url (your preferred captive portal provider's HTTPS URL)
  3. settings put global captive_portal_fallback_url (your preferred captive portal provider's fallback URL, or their HTTP/HTTPS URL)
  4. settings put global captive_portal_other_fallback_urls (your preferred captive portal provider's other fallback URL, or their HTTP/HTTPS URL)
  5. reboot

To verify captive portal url changes :

Disclaimer : This only works for user-set captive portal urls. Therefore, stock default captive portal urls cannot be documented / extracted with this method.

  1. 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)
  2. Exit shell with exit command, no reboot necessary

GUI-based solutions

Sometimes, your custom ROM might have something like this:

DivestOS; Settings > Network & internet

In which case, you can just pick the ones you trust. Unfortunately, if this is present, you can't really use the terminal-based guide above.

Back to top

Android Privacy Mod - Basic

Index - cellphone

Main Page