expo-geofencing
Version: 
Production-ready geofencing and activity recognition for Expo React Native with offline support, security features, and enterprise-grade reliability
121 lines (120 loc) • 5.02 kB
TypeScript
export interface GeofenceRegion {
    id: string;
    latitude: number;
    longitude: number;
    radius: number;
    notifyOnEntry: boolean;
    notifyOnExit: boolean;
}
export interface ActivityRecognitionResult {
    activity: 'still' | 'walking' | 'running' | 'driving' | 'cycling' | 'unknown';
    confidence: number;
    timestamp: number;
}
export interface GeofenceEvent {
    regionId: string;
    eventType: 'enter' | 'exit';
    timestamp: number;
    latitude: number;
    longitude: number;
}
export interface LocationUpdateOptions {
    interval: number;
    fastestInterval: number;
    smallestDisplacement: number;
    priority: 'high_accuracy' | 'balanced' | 'low_power' | 'no_power';
}
export interface SystemStatus {
    locationPermission?: string;
    backgroundRefreshStatus?: string;
    locationServicesEnabled: boolean;
    isMonitoringActive: boolean;
    activeGeofences: number;
    activityRecognitionAvailable?: boolean;
    healthCheckInterval: number;
    isBatteryOptimized?: boolean;
    hasLocationPermission?: boolean;
    hasBackgroundLocationPermission?: boolean;
    hasActivityRecognitionPermission?: boolean;
}
export interface HealthAlert {
    type: string;
    title: string;
    message: string;
    timestamp: number;
    severity?: 'low' | 'medium' | 'high' | 'critical';
}
export interface ServiceStatus {
    isMonitoringActive: boolean;
    activeGeofences: number;
    timestamp: number;
}
export interface DeviceInstructions {
    manufacturer: string;
    instructions: string;
    additionalSettings: string;
}
export interface BatteryOptimizationStatus {
    isBatteryOptimized: boolean;
    isLocationEnabled: boolean;
    deviceInstructions: DeviceInstructions;
}
export interface LocationData {
    latitude: number;
    longitude: number;
    accuracy: number;
    timestamp: number;
    isHealthCheck?: boolean;
}
export interface ExpoGeofencingModule {
    addGeofence(region: GeofenceRegion): Promise<void>;
    removeGeofence(regionId: string): Promise<void>;
    removeAllGeofences(): Promise<void>;
    getActiveGeofences(): Promise<GeofenceRegion[]>;
    startActivityRecognition(intervalMs: number): Promise<void>;
    stopActivityRecognition(): Promise<void>;
    startLocationUpdates(options: LocationUpdateOptions): Promise<void>;
    stopLocationUpdates(): Promise<void>;
    addGeofenceListener(callback: (event: GeofenceEvent) => void): () => void;
    addActivityListener(callback: (result: ActivityRecognitionResult) => void): () => void;
    addLocationUpdateListener(callback: (location: LocationData) => void): () => void;
    addHealthAlertListener(callback: (alert: HealthAlert) => void): () => void;
    addServiceStatusListener(callback: (status: ServiceStatus) => void): () => void;
    getDataManager?(): any;
    getOfflineManager?(): any;
    getSecurityManager?(): any;
    getPolygonManager?(): any;
    getWebhookManager?(): any;
    checkBatteryOptimization?(): Promise<BatteryOptimizationStatus>;
    requestBatteryOptimizationDisable?(): Promise<boolean>;
    openLocationSettings?(): Promise<void>;
    checkSystemStatus?(): Promise<SystemStatus>;
    requestPermissions?(): Promise<boolean>;
    setHealthCheckInterval(intervalMs: number): Promise<void>;
    forceLocationCheck(): Promise<LocationData | void>;
    getServiceStatus?(): Promise<SystemStatus>;
}
export { default } from './ExpoGeofencing';
export { DataManager } from './DataManager';
export { OfflineManager } from './OfflineManager';
export { SecurityManager } from './SecurityManager';
export { PolygonGeofenceManager } from './PolygonGeofence';
export { WebhookManager } from './WebhookManager';
export type { GeofenceEvent as StoredGeofenceEvent, ActivityEvent, SystemHealthEvent, AnalyticsData, DataManagerConfig } from './DataManager';
export type { OfflineGeofence, LocationPoint, OfflineEvent, NetworkStatus } from './OfflineManager';
export type { PrivacyZone, SecurityConfig, AuditLogEntry, LocationProcessingResult } from './SecurityManager';
export type { Point, PolygonGeofenceRegion, AdvancedGeofenceRegion, TimeBasedRule, ConditionalRule } from './PolygonGeofence';
export type { WebhookConfig, WebhookEventType, WebhookPayload, WebhookDeliveryAttempt, WebhookStats } from './WebhookManager';
export declare const validateGeofenceRegion: (region: GeofenceRegion) => boolean;
export declare const validateLocationUpdateOptions: (options: LocationUpdateOptions) => boolean;
export declare const HEALTH_CHECK_MIN_INTERVAL = 60000;
export declare const LOCATION_TIMEOUT_WARNING: number;
export declare const ACCURATE_LOCATION_TIMEOUT_WARNING: number;
export declare const MIN_ACCURACY_METERS = 50;
export declare const MAX_GEOFENCE_RADIUS = 10000;
export declare const DEFAULT_BATCH_SIZE = 50;
export declare const MAX_RETRY_ATTEMPTS = 3;
export declare const DEFAULT_ENCRYPTION_KEY_LENGTH = 32;
export declare const SPATIAL_INDEX_GRID_SIZE = 0.01;
export declare const WEBHOOK_DEFAULT_TIMEOUT = 30000;
export declare const DATA_RETENTION_DAYS = 30;