From 7def8480e349cdef44e18f5f5808a31df4cc6f7d Mon Sep 17 00:00:00 2001 From: Jirat Ki Date: Mon, 18 Jan 2021 21:30:28 +0800 Subject: [PATCH] Remove unused location data payload --- src/services/background-tracking.ts | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/services/background-tracking.ts b/src/services/background-tracking.ts index 67ee1c07..5259e2f9 100644 --- a/src/services/background-tracking.ts +++ b/src/services/background-tracking.ts @@ -3,6 +3,42 @@ import { getAnonymousHeaders } from '../api' import { Platform } from 'react-native' import { API_URL } from '../config' import I18n from '../../i18n/i18n' + +// Custom JSON payload to send to server +// by default the payload will look like +// docs: https://transistorsoft.github.io/react-native-background-geolocation/interfaces/_react_native_background_geolocation_.config.html#locationtemplate +/** + { + "coords": { + "speed_accuracy": 0, + "speed": 6.5899999999999999, + "longitude": -122.02329798, + "floor": 0, + "heading_accuracy": 0, + "latitude": 37.332160719999997, + "accuracy": 10, + "altitude_accuracy": -1, + "altitude": 0, + "heading": 347.52999999999997 + }, + "extras": {}, + "is_moving": true, + "odometer": 1583.2, + "uuid": "55FF6745-4786-4D72-A3CC-ED52067E0E4A", + "activity": { "type": "unknown", "confidence": 100 }, + "battery": { "level": -1, "is_charging": false }, + "timestamp": "2021-01-17T08:32:27.572Z" + } + */ +const LOCATION_TEMPLATE = `{ + "coords": { + "longitude": <%= longitude %>, + "latitude": <%= latitude %>, + "accuracy": <%= accuracy %>, + }, + "uuid": "<%= uuid %>", + "timestamp": "<%= timestamp %>" +}` class BackgroundTracking { setup(startImmediately?: boolean) { if (startImmediately) { @@ -24,6 +60,7 @@ class BackgroundTracking { deferTime: 60 * 1000, // All + locationTemplate: LOCATION_TEMPLATE, locationUpdateInterval: 15 * 60 * 1000, distanceFilter: Platform.OS === 'android' ? 0 : 25, reset: true,