Closed samp84531 closed 1 year ago
Hello @christocracy I have another issue on the variation,
const stated = await BackgroundGeolocation.ready({ url: "URL", autoSync: true, autoSyncThreshold: 5, batchSync: true, maxBatchSize: 25, headers: { AUTHENTICATION_TOKEN: "KEY" }, params: { 'auth_id': props.userdata?.data?.id, 'auth_user_type': props.userdata?.user_type, }, locationsOrderDirection: "DESC", locationAuthorizationRequest: 'Always', logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, debug: true,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 10,
// stationaryRadius: 0,
stopTimeout: 5,
disableElasticity: true,
maxDaysToPersist: 1,
enableHeadless: true,
startOnBoot: true,
stopOnTerminate: false,
backgroundPermissionRationale: {
title: "Allow {applicationName} to access this device's location even when closed or not in use.",
message: "This app collects location data to enable recording your trips to work and calculate distance-travelled.",
positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
negativeAction: 'Cancel'
}
}, (state) => {
console.log("- BackgroundGeolocation is configured and ready: ", state.enabled);
if (!state.enabled) {
console.log('hi sam');
BackgroundGeolocation.start(function () {
console.log("- Start success");
});
}
})
You can expect to see periodic, poor-accuracy locations due to the laws of physics. Particularly when the device is indoors. GPS only works outdoors.
Use Location.coords.accuracy
to filter-out undesired locations.
Hello @christocracy, After a long time, I'm facing one issue from the SDK side.
OS: Android Model: VIVO V2158 Android Version: 13 Plugin Version: 4.13.1
issue: After starting tracking, it ran properly for 2 hours, then stopped automatically and started again after 2-3 hours and logs are also missing in the report.
Model: VIVO V2158
Vivo devices are known to be unreliable. See https://dontkillmyapp.com my
hello @christocracy The above issue is also happening in Redmi devices
OS: Android Model: Xiaomi Redmi Note 5 Pro Android Version: 13 Plugin Version: 4.13.3
issue: After starting tracking, it ran properly for 2 hours, then stopped automatically and started again after 2-3 hours and logs are also missing in the report.
check the log between 09-14 15:44:57 - 09-14 20:36:13.322 DEBUG
Chinese devices in general are horrible. It’s well known that these manufacturers modify their flavour of Android to prevent services from working properly in the background.
Redmi, vivo, Huawei.
I was here for 3-4 hours and then I started tracking again.
@christocracy
I follow this blog every time before starting tracking https://dontkillmyapp.com/
Hello @christocracy, The above issue is also happening in Samsung SM-M317F, and I follow this blog every time before starting tracking https://dontkillmyapp.com/
OS: Android Model: samsung SM-M317F Android Version: 13 Plugin Version: 4.13.3
issue: After starting tracking, it ran properly for 1 hour, then stopped automatically and started again after 10mins, and logs are also missing in the report.
Missing log time is 09-16 15:31:33.890 - 09-16 15:36:38.501
At 15:31
, the device was detected to have stopped moving:
09-16 15:31:33.944 INFO [TrackingService k]
╔═════════════════════════════════════════════
║ TrackingService motionchange: false
╠═════════════════════════════════════════════
At 15:38
, the OS informed the plugin that the device exited the "stationary geofence" place around the device, had been exited and the plugin resumed tracking.
There is nothing unusual about this, other than taking a longer distance than you wish for. The plugin has no control over when the OS evaluates the "stationary geofence" exit. This is completely up to the OS. It did, in fact, work.
09-16 15:36:38.467 INFO [TrackingService changePace]
🔵 setPace: false → true
09-16 15:36:38.467 INFO [GeofencingService b]
╔═════════════════════════════════════════════
║ GeofencingService: Stationary geofence EXIT
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 22.319421,70.839230 hAcc=72.9 et=+83d20h51m43s437ms alt=85.30000305175781 vAcc=5.4117074]
and please stop posting long streams of logs into the issue, it's annoying to scroll through. Use the Github <details>
tag
@christocracy Any other way to fix this issue? This issue messes up my tracking.
stopTimeout: 5,
Increasing your stopTimeout will increase the time it takes to enter the stationary-state.
Once in the stationary-state, the plugin has no control over when the OS informs the plugin when the device is moving (either through Motion API or exiting the "stationary geofence". Certain device manufacturers prevent those APIs from operating promptly in a desire to increase battery life at the expense of proper functionality as documented in the Android API docs.
My Pixel 6 running on Android 14 beta, operating exactly as documented, requires no more than 200 meters of movement before tracking engages. This is how Android is designed to work. What some particular device manufacturer chooses to do is not under any software control
stopTimeout
expired.@christocracy OK thanks, I will check
Here is my bus-trip to shopping mall yesterday on Pixel 6. I always use stopTimeout: 1
because I want the plugin to enter stationary-state quickly in order to test jumping to moving state.
I'm a little confused, how do you draw the green line based on location or what?
That is the “jump” from the stationary state (small red circle) -> moving state. The location is unknown between those two points.
the plug-in typically requires movement of at least 200 meters before motion is recognized when location-services are turned on and the plug-in resumes tracking.
read the wiki “Philosophy of Operation”.
The plug-in uses the onMotionChange
event to draw that green polyline, connecting the last known location (red circle) to the current location when location-services were turned on.
got it, @christocracy thank you!
Your Environment
Plugin version: 4.12.1
Platform: Android
OS version: 13 and 12
Device manufacturer/model: Motorola one fusion plus
React Native version (
react-native -v
): 0.70.6Plugin config
/**
import { AppRegistry } from 'react-native'; import App from './App'; import { name as appName } from './app.json';
import BackgroundGeolocation from "react-native-background-geolocation"; import BackgroundFetch from "react-native-background-fetch";
const BackgroundGeolocationHeadlessTask = async (event) => { let params = event.params; console.log('[BackgroundGeolocation HeadlessTask] -', event.name, params); switch (event.name) { case 'heartbeat': break; case 'authorization': BackgroundGeolocation.setConfig({ url: 'API URL', }); break; } }
BackgroundGeolocation.registerHeadlessTask(BackgroundGeolocationHeadlessTask);
const BackgroundFetchHeadlessTask = async (event) => { console.log('[BackgroundFetch HeadlessTask] start', event.taskId);
}
BackgroundFetch.registerHeadlessTask(BackgroundFetchHeadlessTask); AppRegistry.registerComponent(appName, () => App);
useEffect(() => {