Android – Forçando a conexão com a interface do Wifi quando não há internet (Force Wifi connection with no internet access)

“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!” – https://stackoverflow.com/a/37318745/10512799

Help DEV – Analista desenvolvedor Java / Android https://helpdev.com.br/zarelli

Android – Forçando a conexão com a interface do Wifi quando não há internet (Force Wifi connection with no internet access)

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Esse site utiliza o Akismet para reduzir spam. Aprenda como seus dados de comentários são processados.

Rolar para o topo