Every 15 minutes or so

Dogbonesix

Active Member
Licensed User
Longtime User
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.
 

Dogbonesix

Active Member
Licensed User
Longtime User
Every 15 Minutes

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.

Thanks for the reply.
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
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 ...
 
Upvote 0

Dogbonesix

Active Member
Licensed User
Longtime User
15 Minutes or so

Is there a difference between a Do Whille-Loop and a "StartServiceAt-loop?" Because, that is my problem? If so, please expand.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
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.
 
Upvote 0

Jost aus Soest

Active Member
Licensed User
Longtime User
Is there a difference between a Do Whille-Loop and a "StartServiceAt-loop?" Because, that is my problem? If so, please expand.

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.
 
Upvote 0

Dogbonesix

Active Member
Licensed User
Longtime User
15 Minutes or so

I finally figured it out. The answer was in the "ToolTip Text" not in the documentation. Made many syntax errors in route - but it works now. Thanks
 
Upvote 0
Top