Claudio Vega
Claudio Vega

Reputation: 7

Which Android technology is better suitable for this requirements?

Conditions:

1) The user can create a schedule for each week day.

2) The user only defines the start time of the job.

3) From now a then, the job will be executed each day at the time scheduled in condition 1 and 2

4) The job is executed allways (never enqueued), even with low battery.

Question: Which is better for this?

Upvotes: 0

Views: 64

Answers (2)

Ryan M
Ryan M

Reputation: 20197

If exact timing is a requirement, you'll need to use AlarmManager and manage re-setting your alarms when the device restarts or your app is force stopped. None of the others are currently suited to running work at an exact time. See this guide from the Android Developers site for additional guidance on the differences between these solutions.

Upvotes: 1

codeFood
codeFood

Reputation: 1251

Your requirement (4) is challenging to meet I would say. With the introduction of Doze mode and various other battery saving measures added to later versions of Android, you will not always have full control of it.

If you are flexible on that, your best bet is:

WorkManager

It is the best suited construct for your requirements and for any such requirements. If you read the documentation, it states that WorkManager leverages the other technologies in a way that is best suited to specific versions of Android.

It has APIs to let you achieve all the other tasks that fall in your requirements and on the way handles backwards compatibility well.

Upvotes: 0

Related Questions