This is an interesting question, c When you use as provider NETWORK_PROVIDER
, your device does not need to have the GPS
enabled. You can have both providers enabled or one of them.
There are important differences that I think are important to comment:
-
If your geo-location services are determined by the Wi-Fi or mobile network, the battery consumption is low, but the accuracy of the position is not as reliable.
-
On the other hand, if your geo-location services are determined by GPS, the battery consumption is higher compared to the network provider, but the accuracy of the position is much better.
As I mention, you can use one or both providers, you can even individually determine the availability of one:
private static boolean disponiblepGPS, disponibleRED;
private static LocationManager locManager;
private static String provider;
//Determina si el NETWORK_PROVIDER esta disponible:
try {
disponibleRED = locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
provider = LocationManager.NETWORK_PROVIDER;
} catch (Exception ex) {
Log.e(TAG,"Error obteniendo NETWORK_PROVIDER.");
}
//Determina si el GPS_PROVIDER esta disponible:
try {
disponiblepGPS = locManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
provider = LocationManager.GPS_PROVIDER;
} catch (Exception ex) {
Log.e(TAG,"Error obteniendo GPS_PROVIDER.");
}
Currently, most devices can configure which providers to use to obtain geo-location. To obtain more accurately use the two providers A), to use only the network, with a low power consumption network B) or you can only use GPS C).