Captive portal without internet on Android

Good day. I need Captive Portal on the WiFi hotspot that will work without internet and popup a notification or open a login page automatically. I am using Mikrotik with RouterOS 6.27. I created hotspot and then added a RegExp in DNS like

.* = HOTSPOT_IP_ADDRESS

It works fine in Windows and iOS since their captive portal detection is based on getting the response from some website. Afaik - any response. But for Android it must be some special response, with empty content or status code 204 - I am still not sure.

I tried to emulate google pages which give 204 or empty response and did redirection to my server with this emulation pages but it did not help Android to show notification.

So I need help to make captive portal notification in Android without internet.

Thanks.


Everytime your phone gets associated to the APs it will send an initial test URL request. It's a feature of Android to detect that it is trapped and offer to take the user to the splash page so the user can login and release from the trap.

Just make sure that Android's test URL file is allowed to pass the walled garden.

For reference, default Android 4.0.1 AOSP test URLs is http://clients3.google.com/generate_204, which always returns a 204 response code. Even if DNS has been interfered with since in that case a 200 code will be returned instead of the expected 204.

Also, there are some variations with fetching http://www.google.com/blank.html, which will return a 200 code with zero-length response body. So if you get a non-empty body this would be another way to figure out that you are behind a walled garden.

链接地址: http://www.djcxy.com/p/72108.html

上一篇: 如何存储通过强制门户访问wifi的客户名称?

下一篇: 在Android上没有互联网的圈养门户