Home
Softono

React Native Background Location

Open source MIT TypeScript
20
Stars
0
Forks
0
Issues
2
Watchers
3 months
Last Commit

 About React Native Background Location

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

Platforms

Web Self-hosted

Languages

TypeScript

Need Help Installing React Native Background Location?

We provide expert installation service for this software. Our team will install, configure, and secure React Native Background Location on your server. plans start at just $30.

React Native Background Location

View on GitHub

react-native-background-location

Background GPS tracking and geofencing for React Native, built on the New Architecture.

NPM Version NPM Beta NPM Downloads NPM Total Downloads CI Tests Code Coverage Pre-release CI Release CI GitHub Stars License Bundlephobia Platform Android Platform iOS TypeScript

A TurboModule for the React Native New Architecture. Drives a foreground service on Android and CLLocationManager on iOS, persists every fix to Room and Core Data, and ships native geofencing plus crash recovery so trips survive process death.

Read the full documentation

Features

  • Background tracking with configurable accuracy and distance filter
  • Native geofencing (GeofencingClient on Android, CLCircularRegion on iOS)
  • Persistent location storage (Room on Android, Core Data on iOS)
  • Crash recovery via WorkManager and significant location monitoring
  • React hooks: useBackgroundLocation, useLocationPermissions, useLocationUpdates, useLocationTracking
  • Expo config plugin for managed workflows

Requirements

Requirement Version
React Native >=0.73 (New Architecture required)
iOS >=16.0
Android minSdk 24

Installation

Bare React Native (recommended)

yarn add @gabriel-sisjr/react-native-background-location
cd ios && pod install

Autolinking handles Android manifest merging and iOS pod registration. Bare iOS apps must still add NSLocationWhenInUseUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationAlwaysUsageDescription, and a UIBackgroundModes entry containing location to their Info.plist. See the iOS setup guide for full details.

Quick Start

import {
  startTracking,
  useLocationUpdates,
} from '@gabriel-sisjr/react-native-background-location';

function App() {
  const { locations } = useLocationUpdates();

  return (
    <Button
      title="Start"
      onPress={() => startTracking({ tripId: 'trip-1', distanceFilter: 10 })}
    />
  );
}

See the documentation site for the full hook reference and the permission flow that must run before tracking starts.

Documentation

License

MIT — see LICENSE.