Skip to content

Wifi "connected, but no internet" on Android N 7.1 #761

@T-vK

Description

@T-vK

As a follow-up to #618 I did some digging and it looks like captive_portal_detection_enabled is deprecated: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/provider/Settings.java

I would like to share some things that I changed in order to stay connected to WiFi networks,getting rid of the exclamation mark on the WiFi icon and the "no Internet" message, without allowing specific (system) apps to access the Internet. I also changed some settings to get rid of potential google home-phoning.

For the following steps you need root access:
Install a terminal emulator such as Termux and enter su to get into a root shell.
Alternatively you can do this using adb. (If you have adb set up you can run adb shell and then su to get into a root shell. To get adb to work you'll need to enable usb debugging and potentially install drivers and other things on your computer. Search the Internet for a tutorial.)

  • Run settings put global captive_portal_mode 0
  • Run settings put global captive_portal_detection_enabled 0 (deprecated, but can't hurt)
  • Run settings put global wifi_watchdog_on 0
  • Run settings put global wifi_watchdog_background_check_enabled 0 (deprecated, but can't hurt)
  • I also uninstalled WiFi Privacy Police (it caused massive WiFi drop problems on my Android 7.1 device)

For me this is also a privacy concern and as a second layer of security I replaced the google servers with my own server.

  • Run settings put global captive_portal_server example.com
  • Run settings put global captive_portal_https_server "https://example.com"
  • Run settings put global captive_portal_http_server "http://example.com"

(Technically the server that you enter would have to respond with a 204 status code to HTTP requests. But since we have disabled captive portal detection it doesn't really matter.)

You can now confirm your changes by checking if the output of the following commands matches:

  • Run settings get global captive_portal_mode (should show 0)
  • Run settings get global captive_portal_detection_enabled (should show 0)
  • Run settings get global wifi_watchdog_on (should show 0)
  • Run settings get global wifi_watchdog_background_check_enabled (should show 0)
  • Run settings get global captive_portal_server (should show example.com)
  • Run settings get global captive_portal_https_server (should show https://example.com)
  • Run settings get global captive_portal_http_server (should show http://example.com)

More information:

wifi_watchdog_background_check_enabled

Whether the Wi-Fi watchdog is enabled for background checking even
after it thinks the user has connected to a good access point.
(deprecated)

wifi_watchdog_on

This is the replacement for the deprecated wifi_watchdog_background_check_enabled

captive_portal_detection_enabled

This setting can be used to turn off captive portal detection.
(deprecated)

captive_portal_mode

The replacement for the deprecated captive_portal_detection_enabled.
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_server

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

captive_portal_https_server

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_http_server

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

Some info about my device and software:

Device: Nvidia Shield Table (2014 LTE version)
ROM: Lineage 14.1 (Android 7.1.2)
AFWall+ 2.9.6.1 with license
Xposed v88.1-sdk25 with AFWall+ fix enabled
No system apps/components besides my browser are are allowed to connect to the Internet in AFWall+.

I hope this information is useful to some people. It would be nice if someone would take the time to add this information to a wiki page, readme or so where people would actually be more likely to find it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions