McNinja
McNinja

Reputation: 790

JobScheduler - Schedule Job At Device Bootup?

Is it possible to schedule a job to begin at device bootup using JobScheduler?

Or do I have to use BroadcastReceivers instead?

Upvotes: 0

Views: 138

Answers (2)

prerak
prerak

Reputation: 409

You can do it by setting the setPersisted(true) on the JobInfo object.

Check the official documentation.

Keep in mind that you still need the RECEIVE_BOOT_COMPLETED permission though.

Upvotes: 0

Miguel Ribeiro
Miguel Ribeiro

Reputation: 8184

From my experience you can only do it using BroadcastReceiver. JobScheduler are good when you want to run something based on some conditions, not events (actions).

Upvotes: 1

Related Questions