UNPKG

@gabriel-sisjr/react-native-background-location

Version:

React Native library for background location tracking using TurboModules. Track user location even when the app is minimized or in the background.

51 lines 2.61 kB
import type { TrackingOptions, Coords } from './types'; import { LocationPermissionStatus as LocationPermissionStatusEnum, LocationAccuracy as LocationAccuracyEnum, NotificationPriority as NotificationPriorityEnum } from './types/enums'; export type { Coords, TrackingStatus, LocationUpdateEvent, TrackingOptions, } from './NativeBackgroundLocation'; export type { PermissionState, UseLocationPermissionsResult, UseBackgroundLocationResult, UseLocationTrackingOptions, UseLocationUpdatesOptions, UseLocationUpdatesResult, } from './types'; export type { UseLocationTrackingResult } from './hooks/useLocationTracking'; export declare const LocationPermissionStatus: typeof LocationPermissionStatusEnum; export declare const LocationAccuracy: typeof LocationAccuracyEnum; export declare const NotificationPriority: typeof NotificationPriorityEnum; export { useLocationPermissions, useBackgroundLocation, useLocationTracking, useLocationUpdates, } from './hooks'; /** * Background Location Tracking Module * * Provides location tracking capabilities that continue when the app is in background. * All methods return promises and will warn gracefully if native module is unavailable. */ declare const _default: { /** * Starts location tracking in background for a specific trip * @param tripId Optional trip identifier. If omitted, a new one will be generated * @param options Optional tracking configuration options * @returns Promise resolving to the effective tripId (received or generated) */ startTracking(tripId?: string, options?: TrackingOptions): Promise<string>; /** * Stops all location tracking and terminates the background service * @returns Promise that resolves when tracking is stopped */ stopTracking(): Promise<void>; /** * Checks if location tracking is currently active * @returns Promise resolving to object with active status and current tripId if tracking */ isTracking(): Promise<{ active: boolean; tripId?: string; }>; /** * Retrieves all stored location points for a specific trip * @param tripId The trip identifier * @returns Promise resolving to array of location coordinates with extended location data */ getLocations(tripId: string): Promise<Coords[]>; /** * Clears all stored location data for a specific trip * @param tripId The trip identifier to clear * @returns Promise that resolves when data is cleared */ clearTrip(tripId: string): Promise<void>; }; export default _default; //# sourceMappingURL=index.d.ts.map