android 6.0.1 force wifi connection with no internet access

空扰寡人 提交于 2019-11-30 11:39:48
Olaia

Could you try and set the global setting captive_portal_detection_enabled to 0 (false).

What's actually happening is that by default, everytime you connect to a wifi, the FW will test against a server (typically google) to see if it's a captive wifi (needs login). So if your wifi is not connected to google, this check will fail. After that, the device knows that wifi has no internet connection and simply will not autoconnect to it.

Setting this setting to 0, will avoid this check.

Programatically Settings.Global.putInt(getContentResolver(), Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED, 0);

You can do it through adb for testing purposes:

adb shell settings put global captive_portal_detection_enabled 0

And retrieve it's value like this:

adb shell settings list global | grep "captive"

IMHO this is not very nice thing to do, since you are changing a setting for the user and many FWs don't provide even an advanced setting to enable/disable this by the user itself. (Google doesn't). But maybe it suits your needs.

Hope it helps!

A non-root solution which is a kind of hack tech. :P

  1. Reboot phone, connect to the non-Internet Wifi;
  2. Go to Settings and create a new user;
  3. Continue, continue, and continue until you see "Checking connection";
  4. As soon as you see "checking connection", switch off your phone;
  5. Switch on your phone again, you will be in "Owner" user, keep it;
  6. Toggle Wifi, and the exclamation mark should disappear quickly :)
  7. Remove that new user or just leave it there;

I don't know why, but it works...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!