I have been playing with notifications and and on the surface seems pretty straight forward. But, I want to check some data about every 15 minutes or so. I can do same with a timer but if I leave the app I also lose the timer. Notifications see to be a good idea but I have not found a way to have the event reoccur. There is "OnGoing" but I don't think it does waht I want it to do. Any help is appreciated.
I think I tried that... If I start an application and have a Do While loop within the application that works fine as long as the screen is visible. If I do anything that changes to another screen the Loop is destroyed. I believe if the Do-Loop was within the Notification-Service it would work. But I have no clue to do same.
As mentionned by Klaus you should defintely have a look at Android services and the StartServiceAt method in particular. This is THE correct way to have something run every x minutes regardless on whether the screen is open or not ...
I don't know the reason why you don't like the idea of startServiceAt. Anyway, what you can do is to have a timer in your service. Check every while or so, if 'minutes' is a multiple of 15 and proceed to the sub you want to handle data.
Yes:
An app with a Do While-Loop longer than 5 seconds will be killed by the system.
A Service can sleep 15 minutes (not consuming any memory or battery) and run only when needed.