expo-background-task 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,7 +10,14 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.1.2 — 2025-02-14
13
+ ## 0.1.3 — 2025-03-14
14
+
15
+ ### 💡 Others
16
+
17
+ - added throwing an exception if registerTask is run on an iOS Simulator or a device without background modes enabled ([#35350](https://github.com/expo/expo/pull/35350) by [@chrfalch](https://github.com/chrfalch))
18
+ - [apple] Migrate remaining `expo-module.config.json` to unified platform syntax. ([#34445](https://github.com/expo/expo/pull/34445) by [@reichhartd](https://github.com/reichhartd))
19
+
20
+ ## 0.1.2 - 2025-02-14
14
21
 
15
22
  _This version does not introduce any user-facing changes._
16
23
 
@@ -28,4 +35,4 @@ _This version does not introduce any user-facing changes._
28
35
 
29
36
  ## 0.0.0 — 2025-01-21
30
37
 
31
- > > > > > > > 1362a71283d ([background-task][gradle] - start use new expo modules gradle plugin (#34431))### 🎉 New features- Added expo-background-task package ([#33438](https://github.com/expo/expo/pull/33438) by [@chrfalch](https://github.com/chrfalch))
38
+ - Added expo-background-task package ([#33438](https://github.com/expo/expo/pull/33438) by [@chrfalch](https://github.com/chrfalch))
@@ -20,7 +20,7 @@ try {
20
20
  }
21
21
 
22
22
  group = 'host.exp.exponent'
23
- version = '0.1.2'
23
+ version = '0.1.3'
24
24
 
25
25
  dependencies {
26
26
  implementation 'androidx.work:work-runtime-ktx:2.9.1'
@@ -31,6 +31,6 @@ android {
31
31
  namespace "expo.modules.backgroundtask"
32
32
  defaultConfig {
33
33
  versionCode 23
34
- versionName "0.1.2"
34
+ versionName "0.1.3"
35
35
  }
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundTask.d.ts","sourceRoot":"","sources":["../src/BackgroundTask.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAIrF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAa,QAAQ,oBAAoB,CAMnE,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAWf;AAGD;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE;AAGD;;;;;GAKG;AAcH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"BackgroundTask.d.ts","sourceRoot":"","sources":["../src/BackgroundTask.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAOrF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAa,QAAQ,oBAAoB,CAMnE,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAsBf;AAGD;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE;AAGD;;;;;GAKG;AAcH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC"}
@@ -1,6 +1,9 @@
1
- import { UnavailabilityError } from 'expo-modules-core';
1
+ import { Platform, UnavailabilityError } from 'expo-modules-core';
2
2
  import * as TaskManager from 'expo-task-manager';
3
+ import { BackgroundTaskStatus } from './BackgroundTask.types';
3
4
  import ExpoBackgroundTaskModule from './ExpoBackgroundTaskModule';
5
+ // Flag to warn about running on Apple simulator
6
+ let warnAboutRunningOniOSSimulator = false;
4
7
  // @needsAudit
5
8
  /**
6
9
  * Returns the status for the Background Task API. On web, it always returns `BackgroundTaskStatus.Restricted`,
@@ -50,6 +53,16 @@ export async function registerTaskAsync(taskName, options = {}) {
50
53
  if (!TaskManager.isTaskDefined(taskName)) {
51
54
  throw new Error(`Task '${taskName}' is not defined. You must define a task using TaskManager.defineTask before registering.`);
52
55
  }
56
+ if ((await ExpoBackgroundTaskModule.getStatusAsync()) === BackgroundTaskStatus.Restricted) {
57
+ if (!warnAboutRunningOniOSSimulator) {
58
+ const message = Platform.OS === 'ios'
59
+ ? `Background tasks are not supported on iOS simulators. Skipped registering task: ${taskName}.`
60
+ : `Background tasks are not available in the current environment. Skipped registering task: ${taskName}.`;
61
+ console.warn(message);
62
+ warnAboutRunningOniOSSimulator = true;
63
+ }
64
+ return;
65
+ }
53
66
  console.log('Calling ExpoBackgroundTaskModule.registerTaskAsync', { taskName, options });
54
67
  await ExpoBackgroundTaskModule.registerTaskAsync(taskName, options);
55
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundTask.js","sourceRoot":"","sources":["../src/BackgroundTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AAGjD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAAmC,EAAE;IACtE,IAAI,CAAC,wBAAwB,CAAC,cAAc,EAAE;QAC5C,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;KACnE;IAED,OAAO,wBAAwB,CAAC,cAAc,EAAE,CAAC;AACnD,CAAC,CAAC;AAEF,cAAc;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB,UAAiC,EAAE;IAEnC,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,EAAE;QAC/C,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;KACtE;IACD,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxC,MAAM,IAAI,KAAK,CACb,SAAS,QAAQ,2FAA2F,CAC7G,CAAC;KACH;IACD,OAAO,CAAC,GAAG,CAAC,oDAAoD,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACzF,MAAM,wBAAwB,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IACxD,IAAI,CAAC,wBAAwB,CAAC,mBAAmB,EAAE;QACjD,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;KACxE;IACD,OAAO,CAAC,GAAG,CAAC,sDAAsD,EAAE,QAAQ,CAAC,CAAC;IAC9E,MAAM,wBAAwB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,+EAA+E;AAC/E,mBAAmB;AACnB,wEAAwE;AACxE,6FAA6F;AAC7F,QAAQ;AACR,+DAA+D;AAC/D,gFAAgF;AAChF,aAAa;AACb,qCAAqC;AACrC,MAAM;AACN,IAAI;AAEJ,eAAe;AACf,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,wBAAwB,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\nimport * as TaskManager from 'expo-task-manager';\n\nimport { BackgroundTaskOptions, BackgroundTaskStatus } from './BackgroundTask.types';\nimport ExpoBackgroundTaskModule from './ExpoBackgroundTaskModule';\n\n// @needsAudit\n/**\n * Returns the status for the Background Task API. On web, it always returns `BackgroundTaskStatus.Restricted`,\n * while on native platforms it returns `BackgroundTaskStatus.Available`.\n *\n * @returns A BackgroundTaskStatus enum value or `null` if not available.\n */\nexport const getStatusAsync = async (): Promise<BackgroundTaskStatus> => {\n if (!ExpoBackgroundTaskModule.getStatusAsync) {\n throw new UnavailabilityError('BackgroundTask', 'getStatusAsync');\n }\n\n return ExpoBackgroundTaskModule.getStatusAsync();\n};\n\n// @needsAudit\n/**\n * Registers a background task with the given name. Registered tasks are saved in persistent storage and restored once the app is initialized.\n * @param taskName Name of the task to register. The task needs to be defined first - see [`TaskManager.defineTask`](task-manager/#taskmanagerdefinetasktaskname-taskexecutor)\n * for more details.\n * @param options An object containing the background task options.\n *\n * @example\n * ```ts\n * import * as TaskManager from 'expo-task-manager';\n *\n * // Register the task outside of the component\n * TaskManager.defineTask(BACKGROUND_TASK_IDENTIFIER, () => {\n * try {\n * await AsyncStorage.setItem(LAST_TASK_DATE_KEY, Date.now().toString());\n * } catch (error) {\n * console.error('Failed to save the last fetch date', error);\n * return BackgroundTaskResult.Failed;\n * }\n * return BackgroundTaskResult.Success;\n * });\n * ```\n *\n * You can now use the `registerTaskAsync` function to register the task:\n *\n * ```ts\n * BackgroundTask.registerTaskAsync(BACKGROUND_TASK_IDENTIFIER, {});\n * ```\n */\nexport async function registerTaskAsync(\n taskName: string,\n options: BackgroundTaskOptions = {}\n): Promise<void> {\n if (!ExpoBackgroundTaskModule.registerTaskAsync) {\n throw new UnavailabilityError('BackgroundTask', 'registerTaskAsync');\n }\n if (!TaskManager.isTaskDefined(taskName)) {\n throw new Error(\n `Task '${taskName}' is not defined. You must define a task using TaskManager.defineTask before registering.`\n );\n }\n console.log('Calling ExpoBackgroundTaskModule.registerTaskAsync', { taskName, options });\n await ExpoBackgroundTaskModule.registerTaskAsync(taskName, options);\n}\n\n// @needsAudit\n/**\n * Unregisters a background task, so the application will no longer be executing this task.\n * @param taskName Name of the task to unregister.\n * @return A promise which fulfils when the task is fully unregistered.\n */\nexport async function unregisterTaskAsync(taskName: string): Promise<void> {\n if (!ExpoBackgroundTaskModule.unregisterTaskAsync) {\n throw new UnavailabilityError('BackgroundTask', 'unregisterTaskAsync');\n }\n console.log('Calling ExpoBackgroundTaskModule.unregisterTaskAsync', taskName);\n await ExpoBackgroundTaskModule.unregisterTaskAsync(taskName);\n}\n\n// @needsAudit\n/**\n * When in debug mode this function will trigger running the background tasks.\n * This function will only work for apps built in debug mode.\n * @todo(chrfalch): When we have a usable devtools plugin we can enable this function.\n * @returns A promise which fulfils when the task is triggered.\n */\n// export async function triggerTaskWorkerForTestingAsync(): Promise<boolean> {\n// if (__DEV__) {\n// if (!ExpoBackgroundTaskModule.triggerTaskWorkerForTestingAsync) {\n// throw new UnavailabilityError('BackgroundTask', 'triggerTaskWorkerForTestingAsync');\n// }\n// console.log('Calling triggerTaskWorkerForTestingAsync');\n// return await ExpoBackgroundTaskModule.triggerTaskWorkerForTestingAsync();\n// } else {\n// return Promise.resolve(false);\n// }\n// }\n\n// Export types\nexport {\n BackgroundTaskStatus,\n BackgroundTaskResult,\n BackgroundTaskOptions,\n} from './BackgroundTask.types';\n"]}
1
+ {"version":3,"file":"BackgroundTask.js","sourceRoot":"","sources":["../src/BackgroundTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAyB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,gDAAgD;AAChD,IAAI,8BAA8B,GAAG,KAAK,CAAC;AAE3C,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAAmC,EAAE;IACtE,IAAI,CAAC,wBAAwB,CAAC,cAAc,EAAE;QAC5C,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;KACnE;IAED,OAAO,wBAAwB,CAAC,cAAc,EAAE,CAAC;AACnD,CAAC,CAAC;AAEF,cAAc;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB,UAAiC,EAAE;IAEnC,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,EAAE;QAC/C,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;KACtE;IACD,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxC,MAAM,IAAI,KAAK,CACb,SAAS,QAAQ,2FAA2F,CAC7G,CAAC;KACH;IACD,IAAI,CAAC,MAAM,wBAAwB,CAAC,cAAc,EAAE,CAAC,KAAK,oBAAoB,CAAC,UAAU,EAAE;QACzF,IAAI,CAAC,8BAA8B,EAAE;YACnC,MAAM,OAAO,GACX,QAAQ,CAAC,EAAE,KAAK,KAAK;gBACnB,CAAC,CAAC,mFAAmF,QAAQ,GAAG;gBAChG,CAAC,CAAC,4FAA4F,QAAQ,GAAG,CAAC;YAC9G,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,8BAA8B,GAAG,IAAI,CAAC;SACvC;QACD,OAAO;KACR;IACD,OAAO,CAAC,GAAG,CAAC,oDAAoD,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACzF,MAAM,wBAAwB,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IACxD,IAAI,CAAC,wBAAwB,CAAC,mBAAmB,EAAE;QACjD,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;KACxE;IACD,OAAO,CAAC,GAAG,CAAC,sDAAsD,EAAE,QAAQ,CAAC,CAAC;IAC9E,MAAM,wBAAwB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,+EAA+E;AAC/E,mBAAmB;AACnB,wEAAwE;AACxE,6FAA6F;AAC7F,QAAQ;AACR,+DAA+D;AAC/D,gFAAgF;AAChF,aAAa;AACb,qCAAqC;AACrC,MAAM;AACN,IAAI;AAEJ,eAAe;AACf,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,wBAAwB,CAAC","sourcesContent":["import { Platform, UnavailabilityError } from 'expo-modules-core';\nimport * as TaskManager from 'expo-task-manager';\n\nimport { BackgroundTaskOptions, BackgroundTaskStatus } from './BackgroundTask.types';\nimport ExpoBackgroundTaskModule from './ExpoBackgroundTaskModule';\n\n// Flag to warn about running on Apple simulator\nlet warnAboutRunningOniOSSimulator = false;\n\n// @needsAudit\n/**\n * Returns the status for the Background Task API. On web, it always returns `BackgroundTaskStatus.Restricted`,\n * while on native platforms it returns `BackgroundTaskStatus.Available`.\n *\n * @returns A BackgroundTaskStatus enum value or `null` if not available.\n */\nexport const getStatusAsync = async (): Promise<BackgroundTaskStatus> => {\n if (!ExpoBackgroundTaskModule.getStatusAsync) {\n throw new UnavailabilityError('BackgroundTask', 'getStatusAsync');\n }\n\n return ExpoBackgroundTaskModule.getStatusAsync();\n};\n\n// @needsAudit\n/**\n * Registers a background task with the given name. Registered tasks are saved in persistent storage and restored once the app is initialized.\n * @param taskName Name of the task to register. The task needs to be defined first - see [`TaskManager.defineTask`](task-manager/#taskmanagerdefinetasktaskname-taskexecutor)\n * for more details.\n * @param options An object containing the background task options.\n *\n * @example\n * ```ts\n * import * as TaskManager from 'expo-task-manager';\n *\n * // Register the task outside of the component\n * TaskManager.defineTask(BACKGROUND_TASK_IDENTIFIER, () => {\n * try {\n * await AsyncStorage.setItem(LAST_TASK_DATE_KEY, Date.now().toString());\n * } catch (error) {\n * console.error('Failed to save the last fetch date', error);\n * return BackgroundTaskResult.Failed;\n * }\n * return BackgroundTaskResult.Success;\n * });\n * ```\n *\n * You can now use the `registerTaskAsync` function to register the task:\n *\n * ```ts\n * BackgroundTask.registerTaskAsync(BACKGROUND_TASK_IDENTIFIER, {});\n * ```\n */\nexport async function registerTaskAsync(\n taskName: string,\n options: BackgroundTaskOptions = {}\n): Promise<void> {\n if (!ExpoBackgroundTaskModule.registerTaskAsync) {\n throw new UnavailabilityError('BackgroundTask', 'registerTaskAsync');\n }\n if (!TaskManager.isTaskDefined(taskName)) {\n throw new Error(\n `Task '${taskName}' is not defined. You must define a task using TaskManager.defineTask before registering.`\n );\n }\n if ((await ExpoBackgroundTaskModule.getStatusAsync()) === BackgroundTaskStatus.Restricted) {\n if (!warnAboutRunningOniOSSimulator) {\n const message =\n Platform.OS === 'ios'\n ? `Background tasks are not supported on iOS simulators. Skipped registering task: ${taskName}.`\n : `Background tasks are not available in the current environment. Skipped registering task: ${taskName}.`;\n console.warn(message);\n warnAboutRunningOniOSSimulator = true;\n }\n return;\n }\n console.log('Calling ExpoBackgroundTaskModule.registerTaskAsync', { taskName, options });\n await ExpoBackgroundTaskModule.registerTaskAsync(taskName, options);\n}\n\n// @needsAudit\n/**\n * Unregisters a background task, so the application will no longer be executing this task.\n * @param taskName Name of the task to unregister.\n * @return A promise which fulfils when the task is fully unregistered.\n */\nexport async function unregisterTaskAsync(taskName: string): Promise<void> {\n if (!ExpoBackgroundTaskModule.unregisterTaskAsync) {\n throw new UnavailabilityError('BackgroundTask', 'unregisterTaskAsync');\n }\n console.log('Calling ExpoBackgroundTaskModule.unregisterTaskAsync', taskName);\n await ExpoBackgroundTaskModule.unregisterTaskAsync(taskName);\n}\n\n// @needsAudit\n/**\n * When in debug mode this function will trigger running the background tasks.\n * This function will only work for apps built in debug mode.\n * @todo(chrfalch): When we have a usable devtools plugin we can enable this function.\n * @returns A promise which fulfils when the task is triggered.\n */\n// export async function triggerTaskWorkerForTestingAsync(): Promise<boolean> {\n// if (__DEV__) {\n// if (!ExpoBackgroundTaskModule.triggerTaskWorkerForTestingAsync) {\n// throw new UnavailabilityError('BackgroundTask', 'triggerTaskWorkerForTestingAsync');\n// }\n// console.log('Calling triggerTaskWorkerForTestingAsync');\n// return await ExpoBackgroundTaskModule.triggerTaskWorkerForTestingAsync();\n// } else {\n// return Promise.resolve(false);\n// }\n// }\n\n// Export types\nexport {\n BackgroundTaskStatus,\n BackgroundTaskResult,\n BackgroundTaskOptions,\n} from './BackgroundTask.types';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-background-task",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Expo universal module for BackgroundTask API",
5
5
  "main": "build/BackgroundTask.js",
6
6
  "types": "build/BackgroundTask.d.ts",
@@ -40,5 +40,5 @@
40
40
  "peerDependencies": {
41
41
  "expo": "*"
42
42
  },
43
- "gitHead": "7080126694798ca950d5dc3ef33483a17fa401bb"
43
+ "gitHead": "ee33df50fbe6bf9bb5d772e7f341f85a27cf9993"
44
44
  }
@@ -1,9 +1,12 @@
1
- import { UnavailabilityError } from 'expo-modules-core';
1
+ import { Platform, UnavailabilityError } from 'expo-modules-core';
2
2
  import * as TaskManager from 'expo-task-manager';
3
3
 
4
4
  import { BackgroundTaskOptions, BackgroundTaskStatus } from './BackgroundTask.types';
5
5
  import ExpoBackgroundTaskModule from './ExpoBackgroundTaskModule';
6
6
 
7
+ // Flag to warn about running on Apple simulator
8
+ let warnAboutRunningOniOSSimulator = false;
9
+
7
10
  // @needsAudit
8
11
  /**
9
12
  * Returns the status for the Background Task API. On web, it always returns `BackgroundTaskStatus.Restricted`,
@@ -60,6 +63,17 @@ export async function registerTaskAsync(
60
63
  `Task '${taskName}' is not defined. You must define a task using TaskManager.defineTask before registering.`
61
64
  );
62
65
  }
66
+ if ((await ExpoBackgroundTaskModule.getStatusAsync()) === BackgroundTaskStatus.Restricted) {
67
+ if (!warnAboutRunningOniOSSimulator) {
68
+ const message =
69
+ Platform.OS === 'ios'
70
+ ? `Background tasks are not supported on iOS simulators. Skipped registering task: ${taskName}.`
71
+ : `Background tasks are not available in the current environment. Skipped registering task: ${taskName}.`;
72
+ console.warn(message);
73
+ warnAboutRunningOniOSSimulator = true;
74
+ }
75
+ return;
76
+ }
63
77
  console.log('Calling ExpoBackgroundTaskModule.registerTaskAsync', { taskName, options });
64
78
  await ExpoBackgroundTaskModule.registerTaskAsync(taskName, options);
65
79
  }