react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Locations are not getting captured neither in foreground nor in background (VIVO)
Your Environment
- Plugin version: 4.4.4
- Platform: Android
- OS version: 12
- Device manufacturer / model: VIVO Y15C
- React Native version (
react-native -v): 0.64.0 - Plugin config
export const configureGeolocation = async () => {
const credentials = await getCredential();
const locationConfig = await getLocationConfig();
if(credentials.Token && locationConfig.track_location){
BackgroundGeolocation.setConfig({
// distanceFilter: locationConfig.distance_filter,
headers: { // <-- Optional HTTP headers
"Content-Type": "application/json",
"token": credentials.Token
},
params: { // <-- Optional HTTP params
"auth_token": credentials.Token,
"user_type_id": credentials.Phone,
"device_id": getUniqueId(),
"source": "application",
"user_type": "User"
}
}).then((state) => {
console.log("Background Geolocation Ready")
})
BackgroundGeolocation.ready({
stopOnStationary: false,
disableStopDetection: true,
pausesLocationUpdatesAutomatically: false,
startOnBoot: true,
foregroundService: true,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
debug: true, // <-- enable this hear sounds for background-geolocation life-cycle.
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app.
url: Config.GEOLOCATION_URL + 'geolocations/',
batchSync: true, // <-- [Default: false] Set true to sync locations to server in a single HTTP request.
maxBatchSize: 10,
autoSyncThreshold: 1,
autoSync: true, // <-- [Default: true] Set true to sync each location to server as it arrives.
distanceFilter: 0,
locationUpdateInterval: 60000,
fastestLocationUpdateInterval: 60000,
backgroundPermissionRationale: {
title: "Allow application to access to this device's location in the background",
message: "In order to track your activity in the background, please enable Allow all the time location permission",
}
}, (state)=>{
configureGeolocation()
})
Expected Behavior
Since its configured based on locationUpdateInterval we should keep on receiving location updates every 60 seconds approximately.
Actual Behavior
After we login to the app receiving the first update as soon as BackgroundGeolocation.start() is executed from then the next location capture is very random it will be either 1 or 2 Hour or sometime less than 5 minutes or no updates received at all.
Steps to Reproduce
- Install the app in vivo smartphone with android version 12 and trigger BackgroundGeolocation.start().
Context
Tried all the methods available in this page https://dontkillmyapp.com/vivo , nothing worked out.
Even kept the app in foreground without closing it or terminating it's still the same issue, i also noticed the background process in notification toolbar it will always be running but locations aren't being captured.
Debug logs
Logs
2022-11-30 16:35:30.412 19262-19500/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: []
2022-11-30 16:35:30.414 19262-19500/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: [headlessJobService]
2022-11-30 16:35:30.461 19262-19505/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.a.BackgroundGeolocation <init>]
✅ Google Play Services: connected (version code:12451000)
2022-11-30 16:35:30.502 19262-19505/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.a.BackgroundGeolocation d]
🎾 Start monitoring location-provider changes
2022-11-30 16:35:30.550 19262-19509/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.data.sqlite.a onCreate] CREATE TABLE IF NOT EXISTS locations (id INTEGER PRIMARY KEY AUTOINCREMENT, uuid TEXT NOT NULL DEFAULT '', timestamp TEXT, json TEXT, data BLOB, encrypted BOOLEAN NOT NULL DEFAULT 0, locked BOOLEAN NOT NULL DEFAULT 0);
2022-11-30 16:35:30.552 19262-19509/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.data.sqlite.a onCreate] CREATE TABLE IF NOT EXISTS geofences (id INTEGER PRIMARY KEY AUTOINCREMENT, identifier TEXT NOT NULL UNIQUE, latitude DOUBLE NOT NULL, sin_latitude DOUBLE NOT NULL, cos_latitude DOUBLE NOT NULL, longitude DOUBLE NOT NULL, sin_longitude DOUBLE NOT NULL, cos_longitude DOUBLE NOT NULL, radius DOUBLE NOT NULL, notifyOnEntry BOOLEAN NOT NULL DEFAULT 0, notifyOnExit BOOLEAN NOT NULL DEFAULT 0, notifyOnDwell BOOLEAN NOT NULL DEFAULT 0, loiteringDelay INTEGER NOT NULL DEFAULT 0, extras TEXT);
2022-11-30 16:35:30.575 19262-19509/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.data.sqlite.b prune]
ℹ️ PRUNE -1 days
2022-11-30 16:35:35.887 19262-19505/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [autoSyncThreshold, backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, batchSync, debug, desiredAccuracy, disableStopDetection, distanceFilter, fastestLocationUpdateInterval, locationUpdateInterval, logLevel, maxBatchSize, startOnBoot, stopOnTerminate, url]
2022-11-30 16:35:35.917 19262-19262/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.http.HttpService flush]
╔═════════════════════════════════════════════
║ HTTP Service (count: 0)
╠═════════════════════════════════════════════
2022-11-30 16:37:38.430 19262-19505/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [headers, params]
2022-11-30 16:37:38.454 19262-19262/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.http.HttpService flush]
╔═════════════════════════════════════════════
║ HTTP Service (count: 0)
╠═════════════════════════════════════════════
2022-11-30 16:37:38.461 19262-19505/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.locationmanager.util.c g]
ℹ️ LocationAuthorization: Permission granted
2022-11-30 16:37:38.468 19262-19731/com.onsitego.livtrack.debug I/TSLocationManager: - Enable: false → true, trackingMode: 1
2022-11-30 16:37:38.536 19262-19731/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.s.ActivityRecognitionService b]
🎾 Start motion-activity updates
2022-11-30 16:37:38.559 19262-19731/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.http.HttpService startMonitoringConnectivityChanges]
🎾 Start monitoring connectivity changes
2022-11-30 16:37:38.575 19262-19731/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.locationmanager.device.a c]
🎾 Start monitoring powersave changes
2022-11-30 16:37:38.578 19262-19515/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.http.HttpService a]
╔═════════════════════════════════════════════
║ 📶 Connectivity change: connected? true
╠═════════════════════════════════════════════
2022-11-30 16:37:38.585 19262-19262/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.s.TSScheduleManager oneShot]
⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
2022-11-30 16:37:38.590 19262-19731/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.service.HeartbeatService c]
🔴 Stop heartbeat
2022-11-30 16:37:38.601 19262-19731/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.locationmanager.util.c h]
ℹ️ LocationAuthorization: Permission granted
2022-11-30 16:37:38.603 19262-19731/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.service.TrackingService a]
🔵 setPace: false → false
2022-11-30 16:37:38.743 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] locationsettings
2022-11-30 16:37:38.747 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1
2022-11-30 16:37:38.953 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a]
🎾 ActivityRecognitionService [eventCount: 1]
2022-11-30 16:37:38.960 19262-19743/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.s.ActivityRecognitionService a]
🚘 ️DetectedActivity [type=STILL, confidence=100]
2022-11-30 16:37:38.968 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0
2022-11-30 16:37:38.969 19262-19743/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false]
2022-11-30 16:37:39.008 19262-19262/com.onsitego.livtrack.debug I/BLASTBufferQueue: [ViewRootImpl[TSLocationManagerActivity]#5] constructor()
2022-11-30 16:37:39.018 19262-19393/com.onsitego.livtrack.debug I/BufferQueueProducer: [ViewRootImpl[TSLocationManagerActivity]#5(BLAST Consumer)5](id:4b3e00000005,api:1,p:19262,c:19262) connect: api=1 producerControlledByApp=true
2022-11-30 16:37:39.204 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy]
2022-11-30 16:37:39.209 19262-19393/com.onsitego.livtrack.debug I/BufferQueueProducer: [ViewRootImpl[TSLocationManagerActivity]#5(BLAST Consumer)5](id:4b3e00000005,api:1,p:19262,c:19262) disconnect: api 1
2022-11-30 16:37:39.210 19262-19393/com.onsitego.livtrack.debug I/BLASTBufferQueue: [ViewRootImpl[TSLocationManagerActivity]#5] destructor()
2022-11-30 16:37:39.210 19262-19393/com.onsitego.livtrack.debug I/BufferQueueConsumer: [ViewRootImpl[TSLocationManagerActivity]#5(BLAST Consumer)5](id:4b3e00000005,api:0,p:-1,c:19262) disconnect
2022-11-30 16:37:39.591 19262-19741/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.http.HttpService flush]
╔═════════════════════════════════════════════
║ HTTP Service (count: 0)
╠═════════════════════════════════════════════
2022-11-30 16:37:39.891 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a]
🎾 LocationRequestService [eventCount: 1]
2022-11-30 16:37:39.897 19262-19741/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.s.LocationRequestService b]
╔═════════════════════════════════════════════
║ motionchange LocationResult: 1
╠═════════════════════════════════════════════
╟─ 📍 Location[fused *** hAcc=13.49 et=+4h30m3s295ms alt=803.7000122070312 vAcc=1.0 vel=0.024476457 bear=293.97055 {Bundle[{}]}], age: 571ms, time: 1669806459323
2022-11-30 16:37:39.904 19262-19741/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult]
🔵 Acquired motionchange position, isMoving: false
2022-11-30 16:37:39.906 19262-19741/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 13.49
2022-11-30 16:37:39.987 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a]
🎾 LocationRequestService [eventCount: 2]
2022-11-30 16:37:39.991 19262-19738/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.s.LocationRequestService b]
╔═════════════════════════════════════════════
║ motionchange LocationResult: 1
╠═════════════════════════════════════════════
╟─ 📍 Location[fused *** hAcc=13.022 et=+4h30m3s775ms alt=803.7000122070312 vAcc=1.064525 vel=0.72946966 bear=214.45868 {Bundle[{}]}], age: 185ms, time: 1669806459804
2022-11-30 16:37:39.992 19262-19738/com.onsitego.livtrack.debug W/TSLocationManager: [c.t.l.s.LocationRequestService b]
⚠️ Failed to find SingleLocationRequest: 1
2022-11-30 16:37:39.996 19262-19738/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 1, sticky: false]
2022-11-30 16:37:40.054 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false]
2022-11-30 16:37:40.069 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService onDestroy]
🔴 ActivityRecognitionService destroyed
2022-11-30 16:37:40.072 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService onDestroy]
🔴 LocationRequestService destroyed
2022-11-30 16:37:40.278 19262-19741/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 1 isFinished? true
2022-11-30 16:37:40.282 19262-19741/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false]
2022-11-30 16:37:40.283 19262-19744/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.data.sqlite.b persist]
✅ INSERT: 8918650f-1342-49b1-a119-b515f3ea4947
2022-11-30 16:37:40.318 19262-19744/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.http.HttpService flush]
╔═════════════════════════════════════════════
║ HTTP Service (count: 1)
╠═════════════════════════════════════════════
2022-11-30 16:37:40.355 19262-19262/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.s.ActivityRecognitionService b]
🎾 Start motion-activity updates
2022-11-30 16:37:40.361 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.g.TSGeofenceManager startMonitoringStationaryRegion]
🎾 Start monitoring stationary region (radius: 150.0m 12.9336296,77.6301416 hAcc=13.49)
2022-11-30 16:37:40.418 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a]
🎾 BackgroundTaskService [eventCount: 1]
2022-11-30 16:37:40.420 19262-19262/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.u.BackgroundTaskManager onStartJob] ⏳ startBackgroundTask: 1
2022-11-30 16:37:40.469 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a]
🎾 TrackingService [eventCount: 1]
2022-11-30 16:37:40.473 19262-19262/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.service.TrackingService h]
╔═════════════════════════════════════════════
║ TrackingService motionchange: false
╠═════════════════════════════════════════════
2022-11-30 16:37:40.474 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish TrackingService [eventCount: 0, sticky: true]
2022-11-30 16:37:40.501 19262-19744/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.data.sqlite.b allWithLocking]
✅ Locked 1 records
2022-11-30 16:37:40.502 19262-19744/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.http.HttpService a]
🔵 HTTP POST batch (1)
2022-11-30 16:37:40.503 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a]
🎾 ActivityRecognitionService [eventCount: 1]
2022-11-30 16:37:40.506 19262-19738/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.s.ActivityRecognitionService a]
🚘 ️DetectedActivity [type=STILL, confidence=100]
2022-11-30 16:37:40.518 19262-19738/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false]
2022-11-30 16:37:40.567 19262-19793/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.http.HttpService$i onResponse]
🔵 Response: 200
2022-11-30 16:37:40.572 19262-19793/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.data.sqlite.b destroyAll]
✅ DELETED: (1)
2022-11-30 16:37:40.600 19262-19793/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.data.sqlite.b allWithLocking]
✅ Locked 0 records
2022-11-30 16:37:40.601 19262-19793/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 1
2022-11-30 16:37:40.602 19262-19793/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish BackgroundTaskService [eventCount: 0, sticky: false]
2022-11-30 16:37:40.606 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService onDestroy]
🔴 BackgroundTaskService destroyed
2022-11-30 16:37:40.744 19262-19505/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [headers, params]
2022-11-30 16:37:40.756 19262-19262/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.http.HttpService flush]
╔═════════════════════════════════════════════
║ HTTP Service (count: 0)
╠═════════════════════════════════════════════
2022-11-30 16:37:41.526 19262-19262/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.service.AbstractService onDestroy]
🔴 ActivityRecognitionService destroyed
2022-11-30 16:37:48.608 19262-19741/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.scheduler.ScheduleEvent onOneShot]
╔═════════════════════════════════════════════
║ ⏰ OneShot event fired: TERMINATE_EVENT
╠═════════════════════════════════════════════
2022-11-30 16:37:48.618 19262-19741/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.event.TerminateEvent <init>]
ℹ️ TERMINATE_EVENT ignored (MainActivity is still active).
2022-11-30 16:41:37.034 19262-19262/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.s.TSScheduleManager oneShot]
⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
2022-11-30 16:41:47.114 19262-20038/com.onsitego.livtrack.debug I/TSLocationManager: [c.t.l.scheduler.ScheduleEvent onOneShot]
╔═════════════════════════════════════════════
║ ⏰ OneShot event fired: TERMINATE_EVENT
╠═════════════════════════════════════════════
2022-11-30 16:41:47.127 19262-20038/com.onsitego.livtrack.debug D/TSLocationManager: [c.t.l.event.TerminateEvent <init>]
ℹ️ TERMINATE_EVENT ignored (MainActivity is still active).
There is hard dependency of compileSdkVersion 31 to upgrade the Library to latest version. Is there a work around for this apart from upgrading?
There is hard dependency of compileSdkVersion 31 to upgrade the Library to latest version
If you’re hoping to release your app to the Google Play Store, they now require a minimum targetSdkVersion 31, which requires - minimum compikeSdkVersion 31.
no there is now way around it.
But the same build is working fine with rest of the brands such as Samsung, Mi etc. This issue is very specific to VIVO brand. So there is nowhere mentioned in the change log that this specific issue has been fixed.
And our current build requires a lot of rework to upgrade compileSdkVersion to 31 just to accommodate this library specification.
Can we have a patched version to make it work with the current specification?
Can we have a patched version to make it work with the current specification?
Impossible.
this plugin is developed according to the public Android api docs. If some particular device has problems, see https://dontkillmyapp.com.
Note that changing to compile sdk version is trivial. At worst you will have new deprecation warnings, which you may ignore. All the compile level does is specify which symbols are available at build time.
And it's best not to ignore the point that you can't publish anything below target 31 anymore anyway. There's no point in a patched version because you won't be able to publish it.
31 as both compile and target sdk version is the new baseline expectation for any android app to be useful, it has no value to consider lower versions since they can't be published.
For android apps - because of the new notification permission - a compile version of 33 should be the baseline compile target so you may use library / module versions that require the notification permission symbols, even if you do not target 33 yet. Note the separation between compile and target sdk versions, they imply very different things.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.