Skip to main content

React Native Background Location

Cross-platform background location tracking with TurboModules, geofencing, and real-time updates for React Native

yarn add @gabriel-sisjr/react-native-background-location
npm versionlicenseplatformsnew architecture
📍

Background Tracking

Track user location even when the app is minimized. Foreground service on Android, CLLocationManager on iOS.

🚧

Geofencing

Monitor circular regions with ENTER, EXIT, and DWELL transitions. Up to 100 geofences on Android, 20 on iOS.

TurboModule Performance

Built on React Native New Architecture with TurboModules for synchronous, type-safe native communication.

🔔

Custom Notifications

Fully customizable foreground notifications with action buttons, dynamic updates, and per-platform priority controls.

📱

Cross-Platform

Unified TypeScript API with platform-specific optimizations. Room DB on Android, Core Data on iOS.

React Hooks API

7 purpose-built hooks for every location use case. From simple tracking status to real-time event streams and geofence management.

  • useBackgroundLocation — Full tracking control
  • useLocationUpdates — Real-time location stream
  • useLocationPermissions — Permission management
  • useGeofencing — Geofence CRUD operations
  • useGeofenceEvents — Transition event listener
Explore Hooks
import {
  useBackgroundLocation,
  useLocationPermissions,
} from '@gabriel-sisjr/react-native-background-location';

function TrackingScreen() {
  const { requestPermissions } = useLocationPermissions();
  const { isTracking, startTracking, stopTracking, locations } =
    useBackgroundLocation();

  const handleStart = async () => {
    await requestPermissions();
    await startTracking({ distanceFilter: 50 });
  };

  return (
    <View>
      <Text>Status: {isTracking ? 'Active' : 'Idle'}</Text>
      <Text>Locations: {locations.length}</Text>
      <Button
        title={isTracking ? 'Stop' : 'Start'}
        onPress={isTracking ? stopTracking : handleStart}
      />
    </View>
  );
}