Ido Fang Bentov
Ido Fang Bentov

Reputation: 178

What's the proper way to schedule tasks and reminders in Oreo?

Background

Ever since Android O came out I had trouble with what classes and methods I should use when I want to schedule background sync tasks and notifications, more specifically, I want to do these two separate things:

Because Android O has placed some restrictions on AlarmManager, I cannot set a background service that runs at a specific time of the day, unless I use getForegroundService(), which, as the docs say, should only be used for services that are noticeable to the user.

What I tried / considered

I have been using JobService that runs periodically every so and so hours, but I would prefer for it to run at a more specific time of the day.

I have looked into CalendarProvider, and also considered a push notification service, but it seems to me like an overkill for simple tasks like these.

Question

My final question is what methods I could, or I should use to implement the above features?

Upvotes: 3

Views: 577

Answers (1)

Related Questions