Reliability

Our Mobile SDKs are built to make it easier to build location features in your apps and reliability is one of the core components for achieving this. Our SDKs are designed to handle expected & unexpected scenarios happening on the device and have the ability built in to restore from them.

This doc covers various such scenarios and talks about how the SDK handles them.

What happens when

When What happens
Location is disabled SDK continues to track while waiting for the user to enable the device's location. It also records a location.disabled event and syncs this with the server opportunistically.
Location Permission is denied SDK continues to track while waiting for the user to enable the app's location permission. It also records a location.permission.denied event and syncs this with the server opportunistically.
Device loses network SDK continues to track, queueing the data offline and sending whenever the network is available. SDK also records the duration when the device was disconnected and syncs this with the server once it comes online.
Airplane mode is enabled Same as Device loses network.
Device is on low battery SDK continues to track reducing it's battery consumption until the device comes out of low battery state.
Device is switched off/restarted SDK restarts tracking when the device is switched back on. SDK also records the duration for which the device was switched off and syncs this data with the server when it is switched back on.
Device time is changed SDK detects the change in device's time settings and the server uses the delta between device's local time and the server's current time to fix this out-of-sync device time issue.
App is in the background SDK continues to run in the background, collecting and transmitting location and activity data.
App is killed/swiped away SDK continues to track in the background.
App crashes iOS SDK continues to track even on an app crash and the Android SDK has mechanisms built-in to restore itself with minimal loss of data.


[info] Consuming SDK events

The SDK events mentioned here are available on the dashboard (or the widgets) and on your server in form of webhooks/slack alerts.

Location is disabled

On detecting a change in location settings, the SDK continues to track the user and records location.disabled or location.enabled event respectively. The SDK then syncs these events with the server opportunistically.

What happens if location is disabled and:
  • startTracking API is called?

    startTracking API will start tracking the user and the API will return a success. Since the location services are disabled, the dashboard shows the placeline starting with a "Location disabled" segment and the User API returns location_status as location_disabled.

  • user is being tracked?

    SDK continues to track the user while waiting for the device's location to be enabled again. As this data syncs with the server, the dashboard shows the placeline starting with a "Location disabled" segment and the User entity returns user's location_status as location_disabled.

Location Permission is denied

On detecting a change in app's location permission, the SDK continues to track the user and records location.permission.denied or location.permission.allowed event respectively. The SDK then syncs these events with the server opportunistically.

What happens if location permission is denied and:
  • startTracking API is called?

    startTracking API will start tracking the user and the API will return a success. Since the location permission was denied, the dashboard shows the placeline starting with a "Location permission denied" segment and the User API returns location_status as location_permission_disabled.

  • user is being tracked?

    SDK continues to track the user while waiting for the app's location permission to be allowed again. As this data syncs with the server, the dashboard shows the placeline starting with a "Location permission denied" segment and the User API returns location_status as location_permission_disabled.

Device loses network

On detecting a change in device's network settings, the SDK continues to track the user with offline support. It records device.network.disconnected and device.network.connected events respectively and syncs them with the server opportunistically. Once the network connectivity is lost with the device, the dashboard shows the placeline starting with a "Network offline" segment and the User entity denotes user's network status by is_connected boolean flag.

[warning] Impact of device losing network

Device losing network has no impact on the SDK apart from the HTTP calls. All calls will fail in absence of network connectivity and will NOT be retried by the SDK.

Airplane Mode is enabled

On enabling Airplane mode for a device, the device's GPS continues to work as expected and only disables device's network connectivity. Thus, the SDK with airplane mode enabled behaves exactly to similar to how it does in case of device losing network connectivity.

Device is on Low Battery

On detecting any change in device's battery status the SDK records device.battery.status events and keeps syncing this data with the server opportunistically. When the device goes into Low battery mode the SDK continues to track the user with reduced battery consumption until the device comes out of it.

The device's latest battery stats are displayed on the dashboard along with the user details and is available via the last_battery object property on the User entity.

Device is switched off/restarted

SDK continues to track the user when the device is switched back on after getting switched off/restarted. It records device.switched.off and device.switched.on events respectively to compute the duration for which the device was switched off. It syncs this data with the server when the device is switched on and gets network connectivity.

[warning] For password protected devices

For password protected devices, the user needs to unlock the device for the SDK to resume tracking.

Device time is changed

SDK stores all the data with device's local time as part of the metadata and detects when the device's time has been updated. When the SDK syncs this cached data with the server, it uses the delta between the server's current time and the device's local time stored in each record to fix the issue of device time. You can read more about how we solve this here.

App is in the background

SDK continues to track without any impact if the app goes to the background, collecting and transmitting location and activity data.

App is killed/swiped away

For Android devices:

SDK continues to track in the background without any impact even if the app is killed or swiped away from the "Recent apps" menu, collecting and transmitting location and activity data.

For iOS devices:

When the app is killed/swiped away from the running apps menu, the SDK uses background update APIs provided by iOS to restore itself. With minimal loss of data it restarts tracking, collecting and transmitting location and activity data.

[warning] iOS Background mode capability required

To enable the SDK to restore itself across app kills, your app needs to add background capability to your app. This enables the SDK to listen to background updates from the OS to restore itself.

App crashes

For Android devices:

On an app crash, the app's process is terminated by the OS and this makes the SDK also non-functional till the time either the app is restarted by the user or the app/SDK restores itself. The SDK has mechanisms built-in (using Android OS's background APIs) to restore itself from app crashes with minimal loss of data. Once the SDK receives a callback from any of these APIs, the SDK restores itself and restarts tracking the user.

For iOS devices:

The SDK has a built-in mechanism (using iOS background APIs) to restore itself across app crashes. On an app terminate, the SDK starts listening to background data updates from the OS and it uses this to continue tracking the user without any loss of data.

[warning] iOS Background mode capability required

To enable the SDK to preserve itself across app crashes, your app needs to add background capability to your app. This enables the SDK to listen to background updates from the OS to keep tracking even if the app is crashed.

results matching ""

    No results matching ""