We want to incorporate notifications to our app.
As a start, this PR aims to send a notification to the user when one of their saved events is starting in a few (2) hours. We established that this kind of reminder notification needed to work offline, so I decided to not use a Firebase solution for this.
Instead, I used android's AlarmManager that allows to schedule an Intent, even when the app is closed or when the phone is in standby mode.
What I added:
-NotificationWorker: An interface between UI and the NotificationScheduler. The called method(schedule/unscheduled) enqueues a task so that it can be done asynchronously. Then doWork method calls the appropriate function in NotificationScheduler.
-NotificationScheduler: Schedules/Unschedules notifications using AlarmManager. It's onReceive method is called when the AlarmManager's time is up and triggers the notification.
-Notification.kt : A useful dataclass for representing a notification :) will probably be useful with other types of notifications later on
-In AndroidManifest : added an intent receiver that checks for action BOOT_COMPLETED, in order to reschedule the notification if the phone was shutdown :sunglasses:
We want to incorporate notifications to our app. As a start, this PR aims to send a notification to the user when one of their saved events is starting in a few (2) hours. We established that this kind of reminder notification needed to work offline, so I decided to not use a Firebase solution for this. Instead, I used android's AlarmManager that allows to schedule an Intent, even when the app is closed or when the phone is in standby mode. What I added: -NotificationWorker: An interface between UI and the NotificationScheduler. The called method(schedule/unscheduled) enqueues a task so that it can be done asynchronously. Then doWork method calls the appropriate function in NotificationScheduler.
-NotificationScheduler: Schedules/Unschedules notifications using AlarmManager. It's onReceive method is called when the AlarmManager's time is up and triggers the notification.
-Notification.kt : A useful dataclass for representing a notification :) will probably be useful with other types of notifications later on -In AndroidManifest : added an intent receiver that checks for action BOOT_COMPLETED, in order to reschedule the notification if the phone was shutdown :sunglasses: