Reputation: 372
I am developing one app where I want to schedule notification on a specific date and time.
Specifically on a date when the app trial is over. I am giving a 4-day app trial to the user and when the trial is over.
ex: the user installs the app on 05-03-2020 then the app will give notification on date 08-03-2020
so should I use the work manager to schedule notification or any other option in android?
Upvotes: 1
Views: 1166
Reputation: 561
WorkManager
is intended for tasks that are deferrable - that is, not required to run immediately and required to run reliably even if the app exits or the device restarts. For example:
Alarms (based on the AlarmManager
class) give you a way to perform time-based operations outside the lifetime of your application. For example, you could use an alarm to initiate a long-running operation, such as starting a service once a day to download a weather forecast.
Alarms have these characteristics:
So for your requirement, you should be using an AlarmManager
instead of WorkManager
as you only need to deliver a notification.
Upvotes: 3