Possible Duplicate:
Programmatically find device support GPS or not?
How can I check, is GPS available on the device?
When I try to use the next code
PackageManager pm = context.getPackageManager();
boolean hasGps = pm.hasSystemFeature(PackageManager.FEATURE_LOCATION);
if (hasGps) {
Log.d("TAG", "HAS GPS");
} else {
Log.d("TAG", "HAS NOT GPS");
}
I always get HAS GPS, but my Archos 101IT has no GPS module. Is there a way to check hardware GPS availablity?
Use this code
if you have GPS hardware embedded for your device but it is not enabled then use the following cod to enable it dynamically,
You can call
LocationManager.getAllProviders()
and check whetherLocationManager.GPS_PROVIDER
is included in the list.else you simply use this code
LocationManager.isProviderEnabled(String provider)
method.if return false even in the case if you don`t have GPS in your device