import { BackgroundTaskOptions, BackgroundTaskStatus } from './BackgroundTask.types'; /** * Returns the status for the Background Task API. On web, it always returns `BackgroundTaskStatus.Restricted`, * while on native platforms it returns `BackgroundTaskStatus.Available`. * * @returns A BackgroundTaskStatus enum value or `null` if not available. */ export declare const getStatusAsync: () => Promise; /** * Registers a background task with the given name. Registered tasks are saved in persistent storage and restored once the app is initialized. * @param taskName Name of the task to register. The task needs to be defined first - see [`TaskManager.defineTask`](task-manager/#taskmanagerdefinetasktaskname-taskexecutor) * for more details. * @param options An object containing the background task options. * * @example * ```ts * import * as TaskManager from 'expo-task-manager'; * * // Register the task outside of the component * TaskManager.defineTask(BACKGROUND_TASK_IDENTIFIER, () => { * try { * await AsyncStorage.setItem(LAST_TASK_DATE_KEY, Date.now().toString()); * } catch (error) { * console.error('Failed to save the last fetch date', error); * return BackgroundTaskResult.Failed; * } * return BackgroundTaskResult.Success; * }); * ``` * * You can now use the `registerTaskAsync` function to register the task: * * ```ts * BackgroundTask.registerTaskAsync(BACKGROUND_TASK_IDENTIFIER, {}); * ``` */ export declare function registerTaskAsync(taskName: string, options?: BackgroundTaskOptions): Promise; /** * Unregisters a background task, so the application will no longer be executing this task. * @param taskName Name of the task to unregister. * @return A promise which fulfils when the task is fully unregistered. */ export declare function unregisterTaskAsync(taskName: string): Promise; /** * When in debug mode this function will trigger running the background tasks. * This function will only work for apps built in debug mode. * This method is only available in development mode. It will not work in production builds. * @returns A promise which fulfils when the task is triggered. */ export declare function triggerTaskWorkerForTestingAsync(): Promise; /** * Adds a listener that is called when the background executor expires. On iOS, tasks can run * for minutes, but the system can interrupt the process at any time. This listener is called * when the system decides to stop the background tasks and should be used to clean up resources * or save state. When the expiry handler is called, the main task runner is rescheduled automatically. * @platform ios * @return An object with a `remove` method to unsubscribe the listener. */ export declare function addExpirationListener(listener: () => void): { remove: () => void; }; export { BackgroundTaskStatus, BackgroundTaskResult, BackgroundTaskOptions, } from './BackgroundTask.types'; //# sourceMappingURL=BackgroundTask.d.ts.map