Closed MonaLakshmi2604 closed 5 months ago
They are two different locations. They have different UUID.
✅ INSERT: 30f40ce0-c7c0-4b7a-94c2-b85413d440f1 ✅ INSERT: aa64992b-c2d3-41ae-9e0c-1b1370eb2373
It's not unusual that they happen to have the same latitude / longitude
if the device hasn't moved. Particularly if the device is not outdoors (GPS only works outdoors). When indoors, the location comes from Wifi.
When indoors, the location comes from the latitude / longitude
of the Wifi access point, not the actual device location.
Actually we are testing in the out door environment only, while app is running in the foreground its works properly but when its running in the background only we are facing this problem and also we have tested more than 5km.
When the app is in foreground call back function is happening, but its not works in background running. Kindly check the debug logs in that call back function is not happening..
See wiki “Debugging” and learn how to fetch the plug-in log database.
Hi,
We have followed the methods which you were shared, but still its not working, I have attached the data which was received in our server, till 2023-05-15 13:23:40 only the latitude ,longitude were pushed correctly, the apps runs in the foreground. After that we have closed the app, then its starts to send a repeated latitude and longitude. We have attached the logs in this kindly check that.
Your logs show only one reference of location with uuid: 4cf9d0bf-d8c3-440c-934b-298dc704d188
begin posted to your server.
This is not a problem of the plugin.
05-15 13:23:46.778 DEBUG [TrackingService handleLocationResult]
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 10.938915,76.978285 hAcc=16.914 et=+5d18h19m58s383ms alt=313.6999816894531 vAcc=1.0 vel=0.5937144 bear=359.20853 {Bundle[{}]}]
╟─ Age: 391ms, time: 1684137226382
.
.
.
05-15 13:23:46.844 INFO [b persist]
✅ INSERT: 4cf9d0bf-d8c3-440c-934b-298dc704d188
05-15 13:23:46.849 INFO [HttpService flush]
╔═════════════════════════════════════════════
║ HTTP Service (count: 1)
╠═════════════════════════════════════════════
.
.
.
05-15 13:23:46.887 DEBUG [b first]
✅ Locked 1 records
05-15 13:23:46.888 INFO [HttpService a]
🔵 HTTP POST: 4cf9d0bf-d8c3-440c-934b-298dc704d188
.
.
.
05-15 13:23:47.096 INFO [HttpService$h onResponse]
🔵 Response: 200
05-15 13:23:47.098 DEBUG [b destroy]
✅ DESTROY: 4cf9d0bf-d8c3-440c-934b-298dc704d188
Hi,
I have attached the log in this, you can see that latitude and longitude were generated but it has not been pushed, Why its pushing the previous latitude and longitude itself, This happens while app is running in the background only. In foreground its works properly, whether its related to any mobile issue?
05-15 13:23:47.851 DEBUG [TrackingService handleLocationResult] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 10.938927,76.978282 hAcc=16.11 et=+5d18h19m59s499ms alt=313.6999816894531 vAcc=1.0115529 vel=0.60999686 bear=358.63623 {Bundle[{}]}] ╟─ Age: 349ms, time: 1684137227499
05-15 13:23:47.852 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════
05-15 13:23:47.853 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 17.707 05-15 13:23:47.858 DEBUG [AbstractService finish] ⚙️︎ finish TrackingService [eventCount: 0, sticky: true] 05-15 13:23:47.890 INFO [b persist] ✅ INSERT: 1b676837-c40c-4954-9259-1a078011f583 05-15 13:23:47.894 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 1) ╠═════════════════════════════════════════════
05-15 13:23:47.919 DEBUG [AbstractService start] 🎾 BackgroundTaskService [eventCount: 1] 05-15 13:23:47.920 INFO [BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 14 05-15 13:23:47.930 DEBUG [b first] ✅ Locked 1 records 05-15 13:23:47.931 INFO [HttpService a] 🔵 HTTP POST: 1b676837-c40c-4954-9259-1a078011f583 05-15 13:23:48.099 INFO [HttpService$h onResponse] 🔵 Response: 200 05-15 13:23:48.101 DEBUG [b destroy] ✅ DESTROY: 1b676837-c40c-4954-9259-1a078011f583
but it has not been pushed
It was "pushed" right here:
05-15 13:23:47.931 INFO [HttpService a]
🔵 HTTP POST: 1b676837-c40c-4954-9259-1a078011f583
Hi,
Yes it has pushed but actually not getting into our server, but while app runs in foreground the pushing data is captured in our server. When we kills the app in foreground the last service which we got in foreground is repeatedly pushing. Is it possible to connect in teams or google meet for verify our code is correct or not.
When we kills the app in foreground the last service which we got in foreground is repeatedly pushing.
You've configured the plugin to stopOnTerminate: false
with a distanceFilter: 1
? Of course the plugin continues to record locations after terminate.
possible to connect in teams or google meet for verify our code is correct or not.
I do 1 hour screen-sharing sessions for $500: https://shop.transistorsoft.com/products/video-conference?utm_source=copyToPasteBoard&utm_medium=product-links&utm_content=web
is my config correct?
ngAfterContentInit() {
// /// Step 1: Subscribe to BackgroundGeolocation events.
this.subscriptions.push(BackgroundGeolocation.onLocation((location) => {
this.addEvent('onLocation', location);
}))
this.subscriptions.push(BackgroundGeolocation.onMotionChange((event) => {
this.addEvent('onMotionChange', event);
}))
this.subscriptions.push(BackgroundGeolocation.onActivityChange((event) => {
this.addEvent('onActivityChange', event);
}))
this.subscriptions.push(BackgroundGeolocation.onProviderChange((event) => {
this.addEvent('onProviderChange', event);
}))
/// Step 2: Ready the plugin.
BackgroundGeolocation.ready({
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 1,
stopTimeout: 5,
debug: true, // <-- enable this hear sounds for background-geolocation life-cycle.
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
enableHeadless: true,
stopOnTerminate: false,
// <-- Allow the background-service to continue tracking when user closes the app.
startOnBoot: true, // <-- Auto start tracking when device is powered-up.
}).then((state) => {
// BackgroundGeolocation is now ready to use.
this. Ready = true;
this. Enabled = state.enabled;
this.addEvent('State', state);
});
}
addEvent(name:string, event:any) {
BackgroundGeolocation.setConfig({
//extras: {route_id: 1234},
url: 'http://mydomain.com/insert_bg_data.php?api_key=this.api&uuid='+event.uuid+'&is_moving='+event.is_moving+'×tamp='+event.timestamp+'&latitude='+event.coords.latitude+'&longitude='+event.coords.longitude+'&speed='+event.coords.speed+'&is_charging='+event.battery.is_charging+'&battery_percentage='+event.battery.level,
})
this.zone.run(() => {
this.events.push({
name: name,
json: JSON.stringify(event, null, 2)
})
})
}
Why do you have all this useless this.addEvent('onLocation', location);
stuff copy/pasted from the /example app? Do you even know what it does? It’s useless demo code to add events to a List in the /example app.
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.
Your Environment
npx cap doctor
)#ready
:Expected Behavior
When app is in Background it should push current location data to the server.
Actual Behavior
I can see the new locations in the logs But Its pushing the same data again and again which is got form the foreground.
Steps to Reproduce
Context
Debug logs