1. I created a timer thread which run on background.
2. Check the interval if interval is more than 10 min.
3. It query the local db pick date and time.
4. Check if current time is greater than the received time, query the healthkit/ perdometer data of given time and send to my server.
Problem: Sometimes it runs great but after few hours or i open another app then i think os kill my thread and stops service.
Please help me with the best way to my requirement.
Thank you