I went through the solutions and found that there are many ways to implement location tracking logic.
- Intention + BroadcastReceiver + LocationListener
- Intent + IntentService + AlarmManager
- LocationListener
- other methods or various combinations of the above ...
I am trying to figure out what would be the best way (the most energy efficient way) to achieve the same ...
I have a library class MyLocationClass.java, which has two methods: 1. startTracking () - start sending the user's location after time T and only if the user has moved X distance 2. stopTracking () - stop sending location updates.
The simple answer seems to be a LocationListener due to its built-in Time Passed / Distance Moved features that provide a better user experience, but then ...
I don’t want the GPS to be on all the time? In fact, it should only be included at the intersection of T and X. Would using a Service / IntentService and / or / with an alarm manager timer be the best solution? Could BroadcaastReceivers with LocationListeners be the best solution?
Please suggest.