Skip to content
GuidesToolkitAPI

jobManager

const jobManager: object

Defined in: packages/expo-arcgis-toolkit/src/jobManager.ts:45

The Swift Toolkit’s shared job manager, for expo-arcgis’s long jobs (offline.generateOfflineMap and the other JobRefs).

  • It keeps the jobs added to it across app launches.
  • It gives them background time when the app moves to the background.
  • It can check their status in the background on a schedule.

After a relaunch, jobs() hands back the jobs it kept: call result() on each to follow it to its end.

It needs the expo-arcgis-toolkit config plugin with "jobManager": true, which permits its background task in Info.plist. Without that, its functions throw.

const job = await offline.generateOfflineMap(map, area, 'my-area');
await jobManager.add(job);
const { path } = await job.result();
await jobManager.remove(job);

add(job): Promise<void>

Manages the job: it is kept across launches until it is removed. Saves the jobs.

JobRef<unknown>

Promise<void>

jobs(): Promise<JobRef<unknown>[]>

The jobs it manages, those it kept across launches included.

Promise<JobRef<unknown>[]>

remove(job): Promise<void>

Stops managing the job, typically once it has finished. Saves the jobs.

JobRef<unknown>

Promise<void>

resumeAllPausedJobs(): Promise<void>

Resumes the jobs that paused (when the app was suspended or terminated).

Promise<void>

saveState(): Promise<void>

Saves the jobs now. It also saves them when the app moves to the background or ends.

Promise<void>

setBackgroundStatusCheckInterval(seconds): Promise<void>

Checks the jobs’ status in the background every seconds (the Toolkit’s preferredBackgroundStatusCheckSchedule); null stops it. iOS decides when it actually runs.

number | null

Promise<void>

null

ios — the Kotlin Toolkit has no job manager; on Android its functions do nothing.