I created an android app to get a user's location from LocationManager and Locationlistener with a GPS provider. My minDistance parameter in requestLocationUpdates is 100 (that means that the location is not updated when the distance < 100 meters), and I want to remove updatelocation automatically when the location is not changed (or no new location is received in onLocationChanged) after a long time (ex: 5 minutes), for energy saving purposes.
Write a service to collect data from GPS. Run a thread for 5 mins in which request for GPS coordinates after every minutes, if all the reading are same in those 5 mins. Stop the service, and then you can start it again whenever you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With