Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored reminder service to job for JobScheduler #115

Merged
merged 4 commits into from
Apr 12, 2024

Conversation

0xC0FFEEC0DE
Copy link
Collaborator

The Background Execution Limits that were introduced with Android 8.0 (API level 26) could be the cause for crashes of the app after system boot.
The solution seems to be to do the Background Work with a JobScheduler.
Due to this the reminder service was refactored to a job for the JobScheduler.
However, the crashes could not be reproduced so it is not sure that this change does fix issue #106.

Christian Adams added 4 commits April 4, 2024 21:28
… the past. I suspect it was unintentional. At least the AutoStartReceiver gets not started without it. So I did add it again.

README.md calls the permission RECEIVE_ON_BOOT_COMPLETE. But that seems to be wrong and got renamed to RECEIVE_BOOT_COMPLETED.
Checking action string at AutoStartReceiver#onReceive() as suggested by android studio.
Extended logging of ReminderService.
…PI level 26) the reminder service should be refactored. As preparation for that the alarm and notification handling was moved to AlarmMgr and NotificationMgr.

An Alarm now does not start service directly but sends a broadcast that gets received by the new AlarmReceiver.
AlarmReceiver and AutoStartReceiver start the ReminderService. MainActivity does not need to start the service anymore.
…This should fix #106. I'm not 100% sure about that because I could not reproduce these crashes.

Set minSdkVersion from 19 to 21 to be able to use JobScheduler.
Changed PreferenceMgr from class to object (singleton).
The logic to determine if alarm should be set was moved from MainActivity#onTaskChange() to AlarmMgr#setAlarmForTask().
global_constants.xml: Fixed constant one_day. It was in milliseconds but seconds are required.
Deleted array.xml files in some (but not all) language dependent folders. The content of array.xml needs no translation.
@0xC0FFEEC0DE 0xC0FFEEC0DE self-assigned this Apr 12, 2024
@0xC0FFEEC0DE 0xC0FFEEC0DE merged commit c6921eb into development Apr 12, 2024
10 of 12 checks passed
@0xC0FFEEC0DE 0xC0FFEEC0DE deleted the task-notification branch April 12, 2024 19:56
@udenr udenr mentioned this pull request Nov 21, 2024
This was referenced Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant