Android Question Start Service every morning

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
I need to start a service every morning at 10:00, after executing a query.
If there are some results from the query, I want to display a notification, else not.

I can't understand how to start a service at a specific time and only after executing this query.
Please, help
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Yes, thank you.
Please, if I want instead the next day, after only 5 minutes?
 
Upvote 0

Straker

Active Member
Licensed User
Longtime User
But in your case you can simply use StartServiceAt which schedule the start of a service in the given time.
You only have to check not to schedule an already past time.
So, if now is before 10:00 then schedule for today at ten o'clock. If 10 is already past, schedule for tomorrow at 10.
In the Sub Service_Start you can use StartServiceAt in order to schedule the next task,
 
Upvote 0

Straker

Active Member
Licensed User
Longtime User
Yes, thank you.
Please, if I want instead the next day, after only 5 minutes?
It also depends on 'after only 5 minutes' from what?
If it is from now you can just call StartServiceAt with a scheduled time of date time.now + 5*60*1000 (5 minutes x 60 seconds x ticksXsecond)
 
Upvote 0

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
It is the same. Use a period. Dim p as period. P.minute and so on. Just like p.days

Thank you.. Please, if I have to execute a query, this method, can be created in the service module? Or in the main activity
 
Upvote 0

Straker

Active Member
Licensed User
Longtime User
Thank you.. Please, if I have to execute a query, this method, can be created in the service module? Or in the main activity
Which method? (And why we don't continue in the Italian forum so we can write in our mother tongue?
 
Upvote 0
Top