I've been developing a tracking app for Android in which I need to track a person using GPS fixes very often (10 seconds interval tops).
Turns out that after couple of minutes my phone warned a battery-draining app - my app.
Although I know GPS fixes uses lots of battery, how is it possible to use Google Maps tracking for over an hour without drain-battery and still get instant GPS changes fix?
Thanks a lot.
Here's an idea of what i'm doing:
// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
makeUseOfNewLocation(location);
}
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
};
// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 0, locationListener);
That's pretty much it of battery-draining in my whole code.