Gandalf Member Licensed User Longtime User Jun 8, 2021 #1 Hello, I need Android 8.1 device constantly listening for UDP packets in background. I tried to do exactly as in Background location tracking example, but no success. Service is not stopping but UDP packets are not received when device comes to sleep. Is there any way to make it working?
Hello, I need Android 8.1 device constantly listening for UDP packets in background. I tried to do exactly as in Background location tracking example, but no success. Service is not stopping but UDP packets are not received when device comes to sleep. Is there any way to make it working?
Erel B4X founder Staff member Licensed User Longtime User Jun 8, 2021 #2 It will not work unless you keep the screen turned on. Consider using push notifications instead. Upvote 0
Gandalf Member Licensed User Longtime User Jun 8, 2021 #3 Most of my target devices don't have google services... Is there any alternative of push notifications? Upvote 0
Most of my target devices don't have google services... Is there any alternative of push notifications?
KMatle Expert Licensed User Longtime User Jun 8, 2021 #4 Did you enable the app in energy savings to run in the background (newer Android versions don't allow "unnown" apps to do so by default) Upvote 0
Did you enable the app in energy savings to run in the background (newer Android versions don't allow "unnown" apps to do so by default)
Gandalf Member Licensed User Longtime User Jun 8, 2021 #5 KMatle said: Did you enable the app in energy savings to run in the background (newer Android versions don't allow "unnown" apps to do so by default) Click to expand... Yes, I followed this method and my app is listed as "not saving battery" in Android. No effect though. Upvote 0
KMatle said: Did you enable the app in energy savings to run in the background (newer Android versions don't allow "unnown" apps to do so by default) Click to expand... Yes, I followed this method and my app is listed as "not saving battery" in Android. No effect though.
KMatle Expert Licensed User Longtime User Jun 8, 2021 #6 I have a cheap china tablet which works ok but after some time WiFi seems to be switched off (have to manually switch it on again). Maybe the network doesn't work anymore. You could "ping" a website via OkHttpUtils (simple request) and log if there's a problem after some time (UDP doesn't have any error handling or handshake). Upvote 0
I have a cheap china tablet which works ok but after some time WiFi seems to be switched off (have to manually switch it on again). Maybe the network doesn't work anymore. You could "ping" a website via OkHttpUtils (simple request) and log if there's a problem after some time (UDP doesn't have any error handling or handshake).