Android Question Scheduling a task with Receiver

mcqueccu

Well-Known Member
Licensed User
Longtime User
I can't seem to get this reminder code to work with the receiver module.

With the example attached, it runs when the app is in the foreground, but when it is in the background it doesn't.

Do I need to add

1. Intent code to manifest?
2. Add draw-over apps
3. Both?

Hint: Goto the schedule module and change the time to something like 2 or 3 minutes ahead of current time and test both foreground and background
 

Attachments

  • Project.zip
    24.8 KB · Views: 177

drgottjr

Expert
Licensed User
Longtime User
seems to work for me. i started the app at 1700h and configured the "start at" times for 1800h, 1830h and 1900h. logging was left as you had it. after starting the app, i tapped the home button and started a couple other apps (to make sure yours was in the background) and turned the screen off. i returned to the device at 1930h and saw 3 logged notification updates. i tapped the notification and saw an update showing the time at - approximately - 1900h. the only issue i saw had to do with the accuracy of "start at", but that has already been discussed on the forum. each of the scheduled update times grew later and later, but the notifications were updated.
(note: running on android 12, b4a 12.2, sdk 31)
(note II: the start at times were actually 18,18.5 and 19 to conform to erel's find next time routine)
 
Last edited:
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
seems to work for me. i started the app at 1700h and configured the "start at" times for 1800h, 1830h and 1900h. logging was left as you had it. after starting the app, i tapped the home button and started a couple other apps (to make sure yours was in the background) and turned the screen off. i returned to the device at 1930h and saw 3 logged notification updates. i tapped the notification and saw an update showing the time at - approximately - 1900h. the only issue i saw had to do with the accuracy of "start at", but that has already been discussed on the forum. each of the scheduled update times grew later and later, but the notifications were updated.
(note: running on android 12, b4a 12.2, sdk 31)
(note II: the start at times were actually 18,18.5 and 19 to conform to erel's find next time routine)
Try it with the app closed (swipe it or close it from recent apps) of reboot device
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
When rebooting the device all sheduled services and receivers are lost.
Make your app run at boot. Shedule the next time when it runs after boot.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
When rebooting the device all sheduled services and receivers are lost.
Make your app run at boot. Shedule the next time when it runs after boot.
Thank you. It means I have to add the Reboot Intent in the manifest.

What of the second issue where you manually closed the app from recent apps, and the notification does not pop up or log anything even when the IDE is connected to the phone. How do I fix that one?
 
Upvote 0
Top