Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device can report location with coarse accuracy using a network-based geolocation system.
Constant Value: "android.hardware.location.network"
Constant Value: "android.hardware.location.network"
1. Get a PackageManager Instance and save to myPackageManager.
2. Create a Boolean Variable named bolNBSupported.
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 network-based geolocation ability to a boolean named bolGPSSupported. It will then display a toast displaying the network-based geolocation ability on the device to the user.
bolNBSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION_NETWORK);
if (bolNBSupported) {
Toast.makeText(this, "Device has network-based geolocation feature", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "No network-based geolocation feature!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_LOCATION_NETWORK
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_LOCATION_NETWORK