import { type NitroBackgroundTimer as NitroBackgroundTimerSpec } from './specs/NitroBackgroundTimer.nitro'; export declare const NitroBackgroundTimer: NitroBackgroundTimerSpec; /** * Configuration for the Android foreground service notification used when * background mode is active. All fields are optional; omitted fields fall * back to sensible defaults (generic title, app launcher icon, library * channel id). On iOS this configuration is ignored — iOS does not use a * foreground service for background scheduling. */ export interface BackgroundTimerNotificationConfig { /** Notification title. Default: `"Background Timer Active"`. */ title?: string; /** Notification body text. Default: `"Tap to return to the app"`. */ text?: string; /** * Android notification channel id. Default: `"nitro_bg_timer_channel"`. * Channels are created on first use (API 26+). */ channelId?: string; /** Android notification channel name. Default: `"Background Timer"`. */ channelName?: string; /** * Name of a drawable resource in the consumer app (e.g. `"ic_workout"`) * to use as the notification small icon. If omitted or not found at * runtime, the library falls back to the app's launcher icon, and then * to a generic system icon. */ iconResourceName?: string; } export interface BackgroundTimerConfig { notification?: BackgroundTimerNotificationConfig; } export declare const BackgroundTimer: { setTimeout(callback: () => void, duration: number): number; clearTimeout(id: number): void; setInterval(callback: () => void, interval: number): number; clearInterval(id: number): void; /** * Eagerly disposes all native resources held by the background timer * (wake lock / background task, pending runnables, worker thread). * * After calling `dispose()`, this `BackgroundTimer` instance is permanently * unusable: subsequent calls to `setTimeout` or `setInterval` will throw, * while `clearTimeout` and `clearInterval` are silently no-op. Calling * `dispose()` twice is safe and idempotent. * * This wrapper is shared by all consumers. Use clearTimeout/clearInterval * for ordinary feature cleanup; dispose only when every consumer is done. * Return is not a synchronous cross-platform resource-settlement receipt: * iOS cleanup is dispatched to the main queue. Process termination does * not guarantee that cleanup callbacks run. */ dispose(): void; /** * Configures the Android foreground service notification used when * background mode is active. This owner must have no explicit hold or * uncleared accepted/pending/active timers. Clear its timers and stop * its explicit hold before reconfiguration; other owners may remain active. * New sessions snapshot the configuration; this does not edit a live session. * * On iOS this is a no-op: iOS does not use a foreground service for * background scheduling (the main run loop + `beginBackgroundTask` * handle it natively). * * @throws if called on a disposed `BackgroundTimer` instance. */ configure(config: BackgroundTimerConfig): void; /** * Requests an explicit Android foreground-service hold, including when * there are no timers. Starts remain subject to OS restrictions and can * fail. Neither service promotion nor timer precision is guaranteed. * * Use it to retain this owner's service demand across gaps between timers. * The service and notification are shared: another owner can retain demand * or supply the notification after this owner releases its hold. * * Repeated pending/active requests add no holds. A later request can retry * a recoverable refusal. After process-wide FGS opt-out, native start is a * no-op. On iOS this is a no-op and does not extend its background budget. * * @throws if called on a disposed `BackgroundTimer` instance. */ startBackgroundMode(): void; /** * Releases the explicit background mode requested via * `startBackgroundMode()`. If timers are still active and the implicit * fallback is enabled, the foreground service continues running until * the last timer completes — only the explicit hold is released. * * On a disposed instance this is a silent no-op (for symmetry with * `clearTimeout` / `clearInterval`). iOS: no-op. */ stopBackgroundMode(): void; /** * Disables the automatic Android foreground service fallback for the * lifetime of the process. The first successful call must precede any * timer acceptance or explicit background request across all native owners; * a first call after such use throws even if the timers have finished. * After successful opt-out, repeated calls are no-ops, including with active * timers. Only a fresh process can enable FGS again. iOS: no-op. * * Timers can use the wake-lock fallback while the process remains alive. * There is no guaranteed drift percentage, background execution window * or process survival. The wrapper always forwards this method, including * after disposal; Android's native implementation ignores disposed owners. * * See the README's "Notifications and opt-out" section for app-side * manifest-merger removal. Runtime opt-out does not remove service or * permission declarations and does not establish store approval. */ disableForegroundService(): void; }; //# sourceMappingURL=index.d.ts.map