import type { ActivityOptions, ActivityState, ActivityStateSnapshot, ActivitySummary, GpsStrength, LocationSubscription } from './types'; type StateChangeCallback = (state: ActivityState) => void; type ActivityErrorCallback = (error: Error) => void; /** * Full activity lifecycle manager. * * Manages the complete flow from start → track → pause → resume → end, * with smart GPS control, auto-pause/resume, battery optimization handling, * and offline-first session storage. * * Usage: * ``` * const activity = ActivityManager.createActivity({ name: 'Morning Run' }); * await activity.start(onLocation); * // ... later * const summary = await activity.end(); * ``` */ export declare class ActivityManager { private tracker; private gpsController; private options; private _state; private _sessionId; private _startTime; private _pauseStartTime; private _totalPausedMs; private _pauseCount; private _elapsedMs; private _activeMs; private _totalDistance; private _currentSpeed; private _maxSpeed; private _totalElevationGain; private _lastAltitude; private _pointCount; private _batteryLevel; private _extras; private _uploaded; private stateChangeListeners; private errorListeners; private tickUnsub; private gpsUnsub; private stationaryUnsub; private appStateUnsub; private autoPauseTimer; private _isPaused; constructor(options?: ActivityOptions); /** Current activity state */ get state(): ActivityState; /** Unique session ID (set after start()) */ get sessionId(): string | null; /** Whether tracking is active (not paused, not stopped) */ get isTracking(): boolean; /** Whether the activity is paused */ get isPaused(): boolean; /** Elapsed wall-clock time in ms since start */ get elapsedMs(): number; /** Active tracking time in ms (excluding pauses) */ get activeMs(): number; /** Total paused duration in ms */ get pausedMs(): number; /** Total distance in meters */ get totalDistance(): number; /** Current GPS strength */ get gpsStrength(): GpsStrength; /** Current speed in m/s (null if unknown) */ get currentSpeed(): number | null; /** Get a snapshot of current activity state */ getSnapshot(): ActivityStateSnapshot; /** * Start an activity session. * - Requests permissions if not granted * - Creates a native session in SQLite * - Starts time-based GPS tracking * - Configures smart auto-pause/resume * * @param options - Activity configuration (merged with constructor options) * @returns The session ID */ start(options?: ActivityOptions): Promise; /** * Pause the current activity (stops GPS, keeps session alive). * Returns false if already paused or no active session. */ pause(options?: { reason?: 'manual' | 'stationary'; }): boolean; /** * Resume the current activity after pause. * Returns false if not paused or no active session. */ resume(options?: { reason?: 'manual' | 'movement'; }): boolean; /** * End the current activity. * - Stops GPS tracking * - Finalizes the session in SQLite * - Returns a summary of the activity * - The session data remains in SQLite until syncSessionAll() is called */ end(): Promise; /** * Discard the current activity without saving. * Deletes all collected points from SQLite. */ discard(): Promise; /** * Get all pending (un-uploaded) activity sessions. */ getPendingActivities(): Promise; /** * Upload a specific session to the server. * Returns true if upload was successful. */ uploadSession(sessionId: string, apiUrl: string, headers?: Record): Promise; /** * Upload all pending sessions to the server. * Returns the count of successfully uploaded sessions. */ syncAllPending(apiUrl: string, headers?: Record): Promise; /** Subscribe to activity state changes */ onStateChange(callback: StateChangeCallback): LocationSubscription; /** Subscribe to activity errors */ onError(callback: ActivityErrorCallback): LocationSubscription; /** Subscribe to location ticks during activity */ onTick(callback: (location: import('./types').TimeBasedLocation) => void): LocationSubscription; /** Subscribe to GPS strength changes */ onGpsStrengthChange(callback: (strength: GpsStrength) => void): LocationSubscription; /** Subscribe to stationary/moving state changes (for auto-pause feedback) */ onStationaryChange(callback: (isStationary: boolean) => void): LocationSubscription; private setState; private startAutoPauseTimer; private cancelAutoPauseTimer; private drainPendingQueue; private getAverageAccuracy; } /** * Create a new ActivityManager instance with the given options. */ export declare function createActivityManager(options?: ActivityOptions): ActivityManager; export default ActivityManager; //# sourceMappingURL=ActivityManager.d.ts.map