Turning on WiFi should be good for battery life, but it depends entirely on how your application is encoded. If you look at the Android page in the “Location Strategies” section , it says: “GPS, Cell-ID and Wi-Fi can give the key to users. Determining what to use and trust is a matter of compromise in accuracy, speed and efficiency.” batteries .
You can only get location from WiFi (yes, not connected!):
netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
but this may not be the most accurate solution. GPS uses enough power, but is obviously more accurate than WiFi, and finding unconnected Wi-Fi access points also requires energy. In other words, this is a very difficult question.
, ( ) - Google Play . ( ), Google ( google ).
protected void createLocationRequest() {
mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(15000);
mLocationRequest.setFastestInterval(5000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}
protected void startLocationUpdates() {
LocationServices.FusedLocationApi.requestLocationUpdates(
mGoogleApiClient, mLocationRequest, this);
}
@Override
public void onLocationChanged(Location location) {
mLastLocation = location;
}
PRIORITY_BALANCED_POWER_ACCURACY, PRIORITY_LOW_POWER, PRIORITY_NO_POWER.
. Android , :" , , Network Location Provider GPS, . .
, , WiFi, GPS, , , , . , . URBAN, GPS (- ). WiFi ( ). , URBAN, , WiFi GPS , GPS ( ). , GPS (, ). Wi-Fi, , , . - WiFi , GPS , WiFi. , . , Google ( ).
, . , , , , , , , .
EDIT: , iOS, Android. iOS , . , Apple . Apple , , , . , Apple WiFi, , WiFi iOS .