CorvetteCole / GotoSleep

An Android app that helps you manage a healthy sleep schedule. Licensed under the GPLv3 license
GNU General Public License v3.0
63 stars 9 forks source link

Updated the notifications to use OneTimeWorkRequest #12

Closed aharish closed 5 years ago

aharish commented 5 years ago

I have updated the app to now use WorkManagers OneTimeWorkRequest, which will make scheduling notifications more reliable in the future. It uses Firebase JobDispatcher on API 23+, and AlarmManager before that.

We will no longer need to use services or Broadcast Receivers as Android does all the work for us, and even takes care of device reboots and app force stops.

I have used about 90% of the code from BedtimeNotificationReceiver.java, and used it in a class that extends Worker. I have replaced the calls to this receiver with calls to a Notification Utility class that creates a OneTimeWorkRequest.

This PR should fix #11