UNPKG

2.22 kBPlain TextView Raw
1// @needsAudit
2/**
3 * This return value is to let iOS know what the result of your background fetch was, so the
4 * platform can better schedule future background fetches. Also, your app has up to 30 seconds
5 * to perform the task, otherwise your app will be terminated and future background fetches
6 * may be delayed.
7 */
8export enum BackgroundFetchResult {
9 /**
10 * There was no new data to download.
11 */
12 NoData = 1,
13 /**
14 * New data was successfully downloaded.
15 */
16 NewData = 2,
17 /**
18 * An attempt to download data was made but that attempt failed.
19 */
20 Failed = 3,
21}
22
23// @needsAudit
24export enum BackgroundFetchStatus {
25 /**
26 * The user explicitly disabled background behavior for this app or for the whole system.
27 */
28 Denied = 1,
29 /**
30 * Background updates are unavailable and the user cannot enable them again. This status can occur
31 * when, for example, parental controls are in effect for the current user.
32 */
33 Restricted = 2,
34 /**
35 * Background updates are available for the app.
36 */
37 Available = 3,
38}
39
40// @needsAudit
41export interface BackgroundFetchOptions {
42 /**
43 * Inexact interval in seconds between subsequent repeats of the background fetch alarm. The final
44 * interval may differ from the specified one to minimize wakeups and battery usage.
45 * - On Android it defaults to __10 minutes__,
46 * - On iOS it calls [`BackgroundFetch.setMinimumIntervalAsync`](#backgroundfetchsetminimumintervalasyncminimuminterval)
47 * behind the scenes and the default value is the smallest fetch interval supported by the system __(10-15 minutes)__.
48 * Background fetch task receives no data, but your task should return a value that best describes
49 * the results of your background fetch work.
50 * @return Returns a promise that fulfils once the task is registered and rejects in case of any errors.
51 */
52 minimumInterval?: number;
53 /**
54 * Whether to stop receiving background fetch events after user terminates the app.
55 * @default true
56 * @platform android
57 */
58 stopOnTerminate?: boolean;
59 /**
60 * Whether to restart background fetch events when the device has finished booting.
61 * @default false
62 * @platform android
63 */
64 startOnBoot?: boolean;
65}