Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Android Job Scheduler - calling a job on a recurring schedule until cancelled?

$
0
0

Hi all,

With the release of Oreo/Android 8.0, I'm wanting to replace my GPS foreground service with a scheduled job.

I've looked at the Xamarin Example for Job Scheduler, and honestly I find it quite confusing.

Here is all I want to do:

  1. User taps a button
  2. A job is created and scheduled.
  3. The job is called instantly, and every 30 seconds afterwards until the user taps the button again

The job will be the replacement for my GPS service (which implementes ILocationListener).

Could anyone help clear up what I need to do to achieve this?

I have tried .SetPeriodic(30000), which doesn't seem to work on my test device running Oreo.

The example uses .SetMinimumLatency() and .SetOverrideDeadline() to set some sort of schedule range. Can I set both of these to 30000 (30 seconds) to achieve what I need?

The example uses handlers and passes parameters, etc. Is this required for a Job Scheduler? There's a lot going on for a basic example project, and I'm just getting confused about the requirements.

Thanks in advance, hoping someone can help me clear this up a bit.

Cheers.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>