Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports one or more methods of reporting current location.
Constant Value: "android.hardware.location"
1. Get a PackageManager Instance and save to myPackageManager.
2. Create a Boolean Variable named bolLocationSupported.
3. Set the Minimum and Target SDK version to 8 or greater.
4. In the onCreate method, add the below code. This will return the current location support ability to a boolean named bolLocationSupported. It will then display a toast displaying the current location support ability on the device to the user.
bolLocationSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION);
if (bolLocationSupported) {
Toast.makeText(this, "Device supports current location", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "No current location support!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_LOCATION
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_LOCATION