So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Leopy Periz
#87130 Hi everyone,
I've been searching for lots of hours for an answer, but I can't seem to find a walkaround to this problem.
Basically, I am trying to make my Android smartphone (v8.1) autoconnect its wifi to an ESP8266 set as an AP. The trouble is that, even if it's correctly authenticated, the smartphone quicky finds out there's no internet connection; the AP is hence saved but will NEVER reconnect automatically.
I've narrowed down the problem to a parameter in the Android side, which is "captive_portal_detection_enabled". If I understood correctly, if the AP cannot provide a "204" response to a certain requests (that often involves Google), the smartphone assumes there's no internet available and will then ignore it.

Since I'm trying to identify if a registered smartphone is nearby or not (via MAC address), I was wondering what I could do to solve this.
Specifically, the registered devices would only be 2, both Android and versions 6.0 and up.

The routes I've tried to solve this are:
- simply sniffing the packets. Issue: Only works when the phone is connected on another working wifi ap (otherwise the smartphone randomizes MAC addresses).
- sniffing the packets, but on the Smartphone disable MAC randomization. Issue: it would be a seurity threat; besides, most newer android smartphones do not allow it.
- trying disabling captive_portal_detection_enabled. Issue: requires a rooted phone...wouldn't be so elegant.
- creating an AP with the ESP8266 that can change its SSID (so as to seem like a new wifi) and is not pw protected. Issue: Android - to my knowledge - does not allow autoconnection to unkown open (public) Wifi.

What I've not tried, but I don't know how to do/is a bit risky:
- installing AdAway to block the requests for internet-presence checking
- third-party apps such as automate; could work, but would be a giant energy hog
- finding a way on the ESP to "simulate" a working internet conncection; afterwards, the ESP would switch off the wifi in order to allow the smartphone to receive mobile data.
- Use, as the SSID, the name of a known wifi ap. Unfortunately, the smartphone will then probably disable the autoconnection for the real wifi network with that SSID, whenever it's in range :roll:

How do you keep your ESP8266 connected to your smartphone, without manually reconnecting it when in range?

I should reiterate, my only goal is identifying whenever a specific smartphone is nearby or too far.

Thanks a lot, have a nice day.
User avatar
By QuickFix
#87180 If you only want to know if a certain device is in the neighborhood (and you know it's MAC address) you could have a look at my proof of concept of a few years back that is using the onSoftAPModeProbeRequestReceived-event, maybe it can inspire you. :idea: