Closed Fuhrmann closed 4 years ago
Ok, I've tested this right now using my own device and it seems the updates are being called more frequently, even I'm in the same place and not moving (my location its not changing), here are the logs:
05-01 01:26:07.562 17050-17050/package I/DefaultLocationProvider: GPS is already enabled, getting location...
05-01 01:26:07.563 17050-17050/package I/DefaultLocationProvider: LastKnowLocation is not usable.
Ask for location update...
05-01 01:26:27.588 17050-17050/package I/DefaultLocationProvider: We waited enough for GPS, switching to Network provider...
05-01 01:26:27.591 17050-17050/package I/DefaultLocationProvider: Network is enabled, getting location...
05-01 01:26:27.596 17050-17050/package I/DefaultLocationProvider: LastKnowLocation is not usable.
05-01 01:26:27.597 17050-17050/package I/DefaultLocationProvider: Ask for location update..
05-01 01:21:03.662 16344-16552/package D/MyService$MyTask: Sending location to server
05-01 01:21:04.548 16344-16569/package D/MyService$MyTask: Sending location to server
05-01 01:21:05.500 16344-16583/package D/MyService$MyTask: Sending location to server
05-01 01:21:06.539 16344-16636/package D/MyService$MyTask: Sending location to server
05-01 01:21:07.511 16344-16552/package D/MyService$MyTask: Sending location to server
05-01 01:21:08.562 16344-16569/package D/MyService$MyTask: Sending location to server
05-01 01:21:09.546 16344-16583/package D/MyService$MyTask: Sending location to server
05-01 01:21:10.565 16344-16636/package D/MyService$MyTask: Sending location to server
05-01 01:21:11.533 16344-16552/package D/MyService$MyTask: Sending location to server
05-01 01:21:12.505 16344-16569/package D/MyService$MyTask: Sending location to server
05-01 01:21:13.524 16344-16583/package D/MyService$MyTask: Sending location to server
05-01 01:21:14.506 16344-16636/package D/MyService$MyTask: Sending location to server
05-01 01:21:15.486 16344-16552/package D/MyService$MyTask: Sending location to server
05-01 01:21:16.552 16344-16569/package D/MyService$MyTask: Sending location to server
05-01 01:21:17.532 16344-16583/package D/MyService$MyTask: Sending location to server
05-01 01:21:18.529 16344-16636/package D/MyService$MyTask: Sending location to server
05-01 01:21:19.662 16344-16552/package D/MyService$MyTask: Sending location to server
05-01 01:21:20.559 16344-16569/package D/MyService$MyTask: Sending location to server
05-01 01:21:24.555 16344-16583/package D/MyService$MyTask: Sending location to server
Good catch! 👍 I assume it happens because, everytime I request a new update but don't cancel the previous one. Which initially it requests immediate update as timeInterval 0.
Nice! I'm using the AlarmManager instead for now! It works great.
Sorry for late action, but this should solve the problem.
I'll try to do other bugfixes as well, and release 2.1.0 version as short term plan.
No problem, thanks for taking the time to fix this issue!
I'm using a Service to get the user location and keep track of it. This is my configuration:
My
onLocationChange
method:Then in MyAsyncTask I just send the data to my server.
I start the service in my MainActivity:
I specify that I want the location every 5 minutes and want to keep track of it. I setup the emulator GPS data with a KML file and start the emulator GPS playback:
As you can see in the image above the data have a delay of 2 seconds between every location update. Even with the 2 seconds delay on each update, I dont want to be notified every 2 seconds. I want to be notified in a interval of 5 minutes as I specified in the configuration builder. Is this possible? Am I missing something, maybe this is supposed to work this way?
Logs
Thank you for your help!