The phone keeps sending identical coordinates even if I travel.
Closed this issue · 8 comments
Your Environment
- Plugin version: 1.9.0-beta.4
- Platform: Android
- OS version: 8.1.0
- Device manufacturer / model: OnePlus 5T
- Nativescript version (
tns info
): 4.2.4 - Plugin config:
{
startOnBoot: true,
stopOnTerminate: false,
foregroundService: true,
url: 'private info. but set',
method: 'POST',
distanceFilter: 0,
locationUpdateInterval: 1000,
allowIdenticalLocations: true,
activityRecognitionInterval: 0,
}
Expected Behavior
I expect the coordinates to change accordingly with my position.
Actual Behavior
The plugin works perfectly speaking in terms of movement detection. The POST to the server too, the only thing I've noticed is that it keeps sending the identical coordinates, no matter the place where I am. To be more precise the coordinates point to my address. Which is where I started it up the first time. I'm still using it without license but I'm planning to buy one. Is it maybe for this reason?
Context
I'm trying to understand how the plugin works before going with the license. More precisely I'm trying to track a phone position at regular time intervals.
Your server is probably returning an error and the plugin keeps:
- trying
- trying
- trying
- trying
...
Are you observing the logs?
On the phone you mean? Where can I find them?
See wiki Debugging
I'll give it a look. Thank you!
In the logs you see stuff like this:
╔═════════════════════════════════════════════
║ LocationService: location
╠═════════════════════════════════════════════
╟─ 📍 Location[45.519199,-73.617054]
✅ INSERT: 70727f8b-df7d-48d0-acbd-15f10cacdf33
╔═════════════════════════════════════════════
║ HTTP Service
╠═════════════════════════════════════════════
✅ Locked 1 records
🔵 HTTP POST: 70727f8b-df7d-48d0-acbd-15f10cacdf33
🔵 Response: 200
✅ DESTROY: 70727f8b-df7d-48d0-acbd-15f10cacdf33
# | Log entry | Description |
---|---|---|
1 | 📍Location |
Location received from native Location API. |
2 | ✅INSERT |
Location record inserted into SDK's SQLite database. |
3 | ✅Locked |
SDK's HTTP service locks a record (to prevent duplicate HTTP uploads). |
4 | 🔵HTTP POST |
SDK's HTTP service attempts an HTTP request to your configured url . |
5 | 🔵Response |
Response from your server. |
6 | ✅DESTROY|UNLOCK |
After your server returns a 20x response, the SDK deletes that record from the database. Otherwise, the SDK will UNLOCK that record and try again in the future. |
My bad! I feel so dumb hahahah. Forgot to send back 200 from the API. Closing it.
ALWAYS watch the logs.
Will keep this in mind. Thank you again