Android Question How to pop-up a reminder each day at a user specified time

cbanks

Active Member
Licensed User
Longtime User
Can you please point me in the right direction how I would accomplish this? I want a user to select a time of day and then I want a notification to pop-up on their screen each day at that time. Thanks!
 
Last edited:

edgar_ortiz

Active Member
Licensed User
Longtime User
You can check:

 
Upvote 0

cbanks

Active Member
Licensed User
Longtime User
I suppose I will need to run a service? Does the service always run and then pops up a notification at a certain time?
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Check this:
 
Upvote 0

cbanks

Active Member
Licensed User
Longtime User
Thanks asales. I believe that will help me get the ticks for the user-specified time.

I'm still lost on how to pop-up a reminder at that time each day. Would some be willing to provide some code examples to get me pointed in the right direction? I just don't know how to have something running in the background and pop-up a notification at that time. Some basic code would be helpful to get me in the right direction.
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
You should make a service class to handle it. The service sets a "run again at this time" message that the OS uses to track it. When that time comes around it wakes the service up and let's it do its thing.

As for the "pop-up", look up Notification Builder
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
...What about: adding event to Google Calendar...

...May be it is safer... due permissions and unexpected STOP-broke services.. never tried but you can check it...
 
Upvote 0

cbanks

Active Member
Licensed User
Longtime User
Thanks for all your help everyone! I got it figured out!

One thing I had to do to get the service to start when the app wasn't running was I had to change a setting for my app on my device. It was set to Restricted (restrict battery usage while this app is running in the background). I had to change it to Unrestricted (allow this app to use battery in the background without restrictions) so that the service would start at the specified time.

Any ideas how to make this change programmatically in B4A so that my app will run in the background and the service won't be stopped?
 
Last edited:
Upvote 0
Top