Building on the ‘Background Location Tracking’ example. I am trying to do something similar with UDP Sockets.
I need to receive UDP broadcast packets from several Huzzah32-ESP32 with an array of connected sensors every few seconds or so, log this data in a database and if specific trigger values are received, notify the user.
This all works as expected when the phone is active/alive. All Broadcast UDP packets are received, however when the screen times out or the user suspends the phone, all Broadcast UDP packets cease?
I know the service is still running, it is not being stopped or destroyed, I put a timer in the service to show a heartbeat in the log and this occurs without fail.
Then I tried, In the timer, to pole one of the devices, I send a UDP Packet to one of the ESP32 and receive a reply, even when the phone is suspended, ok… so Wi-Fi and UDP communications is still active and works when the phone is suspended, so its just not receiving unsolicited UDP broadcast.
But I don’t really want it working this way I just wanted to receive all the Broadcasts and log those regardless of phone active/sleep status i really don't want to have to pole all the boards for a status update.
Any Ideas on how to keep receiving UDP 'Broadcast' packets in the background when the phone is suspended?