react-native-background-geolocation
This is a minimal demonstration app showcasing the core functionality of the react-native-background-geolocation plugin.
The app is intentionally simplified compared to the Advanced demo and is designed to demonstrate basic SDK usage, lifecycle control, and event handling without maps or complex configuration UI.
- Node.js (LTS recommended)
- React Native CLI environment set up
- Android Studio (for Android)
- Xcode (for iOS)
- CocoaPods (iOS)
Ensure your React Native development environment is properly configured:
https://reactnative.dev/docs/environment-setup
git clone https://github.com/transistorsoft/react-native-background-geolocation.git
cd react-native-background-geolocation/example/HelloWorld
npm install
Ensure an emulator or device is running, then execute:
npx react-native run-android
Install pods (first run only):
cd ios
pod install
cd ..
Then run:
npx react-native run-ios
The HelloWorld Demo App provides a stripped-down example of how to integrate and interact with the Background Geolocation SDK.
It focuses on core SDK concepts without advanced UI, mapping, or live configuration features.
-
Tracking toggle
- Calls
BackgroundGeolocation.start()andBackgroundGeolocation.stop()to enable or disable location tracking.
- Calls
-
Play / Pause button
- Calls
BackgroundGeolocation.changePace(true)andBackgroundGeolocation.changePace(false)to manually toggle the moving / stationary state. - The plugin also calls
changePace(isMoving)automatically when:- The device is detected to be moving (typically after ~200 meters), or
- The device is detected to be stationary for
GeoConfig.stopTimeoutminutes.
- Calls
-
Get Current Position button
- Calls
BackgroundGeolocation.getCurrentPosition()to request a single high-accuracy location sample on demand.
- Calls
-
Displays current:
- Tracking state (enabled / disabled)
- Motion state (moving / stationary)
- Activity type (still, walking, running, in_vehicle, etc.)
- Last recorded location (coordinates, speed, accuracy)
- Odometer distance
-
Subscribes to core SDK events:
onLocationonMotionChangeonActivityChangeonProviderChangeonGeofence(if geofences are configured programmatically)
On first launch, the app requires registration with Transistor Software’s demo tracking server:
https://tracker.transistorsoft.com
You will be prompted to enter:
- Organization
- Username
Once registered:
-
A tracker authorization token (JWT) is generated
-
Location data is posted to the demo server
-
Tracking results can be viewed in a browser at:
⚠️ This demo server is for testing and demonstration purposes only.
The HelloWorld app intentionally omits:
- Map view and geofence visualization
- Live configuration editor
- Polygon and circular geofence creation UI
- Advanced debugging and management actions
For full feature demonstrations, see the Advanced demo app.
- This app is designed for learning and reference, not production use.
- SDK configuration is defined in code and is not editable at runtime.
- Ideal as a starting point for understanding SDK lifecycle and event flow.
- Plugin documentation:
https://transistorsoft.github.io/react-native-background-geolocation/latest/ - GitHub repository:
https://github.com/transistorsoft/react-native-background-geolocation