Location Tracking - GrasspIt/GrasspReactNativeDriverApp GitHub Wiki

Background location tracking is handled on the DashboardScreen.

Location Updates

Locations updates will be enabled if:

  • permissions are granted by the user,
  • the driver is logged in, and
  • the driver is on-call.

When enabled, location updates are sent to the api every 400 meters or .25 miles.

Foreground vs. Background

When in the foreground, a bar is displayed on the top of the device indicating that the app is actively tracking the driver's location.

Because it drains battery life in the foreground, the app will become backgrounded after a few minutes of disuse. When the app becomes backgrounded, location updates are batched every 5 minutes.

Task Manager

Because it is a background task, the function that sets the location is defined in the TaskManager, called in the global scope of the app.

In this case, it is located toward the bottom of the DashboardScreen.