Conserve power with location services by detecting user movement using sensors

I am working on an application that tracks the location of a user. To save battery, I want to implement an unoccupied zone that makes the location manager less often (or even stops) in the GPS location. After the user starts moving again (detected by the accelerometer and / or significant movement), the location service will pull for the default interval.

One approach is to define the standby area as parameter minDistancein LocationManager::requestLocationUpdates, but other users here assume that it has no effect on battery drain , and the documentation indicates that it’s difficult for the location manager to save the battery using the following criteria:

However, the location provider is more difficult to save energy using the minDistance parameter, therefore minTime should be the main tool to save battery life.

Google also suggests using a significant motion sensor to detect when a user's location changes:

At a high level, a significant motion detector is used to reduce the power consumption of positioning. When localization algorithms detect that the device is static, they can switch to low power mode, where they rely on significant movement to wake the device when the user changes location.

Does this mean that the location manager uses a significant motion sensor, if it is present by default, or do I need to activate or implement something in order to use the location service?

? , , , , , . Google , ( ).

, GPS , , GPS?

+4
1

LocationManager::requestLocationUpdates significant motion sensor, setSmallestDisplacement() :

mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(20*1000);
mLocationRequest.setFastestInterval(10*1000);
mLocationRequest.setSmallestDisplacement(10F); //meters
0

Source: https://habr.com/ru/post/1598231/


All Articles