If you’re using an Android phone with LineageOS or similar close-to-stock ROM in mainland China you may have problems with NTP not syncing and every WiFi network being marked as “no internet access”.
By default Android tries to access http://connectivitycheck.android.com/generate_204
to determine if a network has internet access. This is also used for captive portal detection. The android.com
domain is completely blocked by the Great Firewall.
The default NTP server is 2.android.pool.ntp.org
. At lease some of the servers in this pool are either blocked or have poor connectivity from China.
You could work around this by using a VPN all the time. But it’s actually easy to change these settings, and you only need ADB access, not root.
First change the connectivity check URL to Google’s China holding page.
adb shell settings put global captive_portal_http_url 'http://www.google.cn/generate_204' adb shell settings put global captive_portal_https_url 'https://www.google.cn/generate_204'
You can use another URL that generates a HTTP 204 response if you don’t want to rely on anything Google.
Next change the NTP server:
adb shell settings put global ntp_server pool.ntp.org
pool.ntp.org
should give servers geographically close to you. Alternatively you might like to use cn.pool.ntp.org
.