about summary refs log tree commit diff
path: root/src/lib/bg-scheduler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/bg-scheduler.ts')
-rw-r--r--src/lib/bg-scheduler.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/bg-scheduler.ts b/src/lib/bg-scheduler.ts
new file mode 100644
index 000000000..db3f2d7fd
--- /dev/null
+++ b/src/lib/bg-scheduler.ts
@@ -0,0 +1,18 @@
+import BackgroundFetch, {
+  BackgroundFetchStatus,
+} from 'react-native-background-fetch'
+
+export function configure(
+  handler: (taskId: string) => Promise<void>,
+  timeoutHandler: (taskId: string) => void,
+): Promise<BackgroundFetchStatus> {
+  return BackgroundFetch.configure(
+    {minimumFetchInterval: 15},
+    handler,
+    timeoutHandler,
+  )
+}
+
+export function finish(taskId: string) {
+  return BackgroundFetch.finish(taskId)
+}