Android captive portal

Last updated : 17/1/2023

- Introduction -

- Prerequisites -
Captive portal mode | Captive portal server

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 debugging) :

  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 (rooted) :

  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 Magisk apk is not 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 I would recommend. 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 :

  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
Back to top

Index - cellphone

Main Page