My Android app stops sending data to the web service after a day or two...


New member
Apr 6, 2023
Visit site
Hello fellow developers,

I am having trouble with an Android app I am working on that is programmed to send GPS data to a web service every 2 hours. The issue is that after about a day or two, the service appears to be interrupted on the phone, and data is no longer sent. The data starts sending again either when one touches the phone or the service is started again from the app or the phone is switched off and turned back on.

All Android settings are set to not let the app go to sleep and to ignore battery optimization for my app, and it is also a foreground service.

I am wondering if anyone has any insight into what could be causing this issue and how to fix it? I appreciate any help or advice you can offer!

To troubleshoot this issue, I have tried the following with no success:

I have checked the app for error messages or exceptions, but none are being thrown when it stops sending data to the web service. I have set an alarm to see that keeps the app working in non-interactive mode. It works for a few days and then stops again even with the alarm set and going off everyday. I have checked the web service logs, but there are no errors or issues on that side that would prevent the data from being received. I have tested the app on multiple devices, and the issue occurs mostly in Sony Xperia, Samsung S22 etc. I have tried different intervals for sending the GPS data to the web service (e.g., every 10 mins), but the issue persists. I have tried wakelock/caffeine apps to keep the CPU running.

B. Diddy

Senior Ambassador
Mar 9, 2012
Visit site
Welcome to Android Central! I moved this to the Software Development forum for more specific traffic.

Forum statistics

Latest member