// Type definitions for react-native-background-geofencing // Project: https://github.com/jgkiano/react-native-background-geofencing // Definitions by: Kiano (@jgkiano) // Definitions: https://github.com/jgkiano/react-native-background-geofencing/blob/master/index.d.ts export interface RNGeofence { id: string; lat: number; lng: number; radius: number; expiration: number; notificationResponsiveness: number; loiteringDelay: number; setDwellTransitionType: boolean; registerOnDeviceRestart: boolean; setInitialTriggers: boolean; } export type RNGeofenceEventName = | 'ENTER' | 'EXIT' | 'DWELL' | 'UNKNOWN' | 'ERROR'; export interface RNGeofenceNotification { title?: string; text?: string; importance?: number; channelId?: string; channelName?: string; channelDescription?: string; } export interface RNGeofenceWebhook { url: string; timeout?: number; exclude?: Array; headers?: { [key: string]: any; }; meta?: { [key: string]: any; }; } export interface RNGeofenceEventData { accuracy: number; altitude: number; bearing: number; time: number; provider: string; lat: number; lng: number; geofenceIds: Array; } export interface RNEventPayload { event: RNGeofenceEventName; data: RNGeofenceEventData; } export interface RNGeofenceJsTask { task: (payload: RNEventPayload) => Promise; } export interface RNGeofenceConfiguration { notification?: RNGeofenceNotification; webhook?: RNGeofenceWebhook; jsTask?: RNGeofenceJsTask; } export interface LocationPermissionRational { title?: string; message?: string; buttonNeutral?: string; buttonNegative?: string; buttonPositive?: string; } //-- methods --// export function isLocationServicesEnabled(): Promise; export function configureNotification( notification: RNGeofenceNotification, ): Promise; export function configureWebhook(webhook: RNGeofenceWebhook): Promise; export function configureJSTask(jsTask: RNGeofenceJsTask): void; export function openLocationServicesSettings(): void; export function requestEnableLocationServices(): Promise; export function isGooglePlayServicesAvailable(): Promise; export function requestEnableGooglePlayServices(): Promise; export function requestLocationPermission( rationale?: LocationPermissionRational, ): Promise; export function isLocationPermissionGranted(): Promise; //-- default export --// export interface BackgroundGeofencing { add(geofence: RNGeofence): Promise; remove(geofenceId: string): Promise; configure(configuration: RNGeofenceConfiguration): Promise; init(): void; restart(): void; } declare const RNBackgroundGeofencing: BackgroundGeofencing; export default RNBackgroundGeofencing;