Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports WiFi (802.11) networking.
Constant Value: "android.hardware.wifi"
1. Get a PackageManager Instance named myPackageManager.
Constant Value: "android.hardware.wifi"
1. Get a PackageManager Instance named myPackageManager.
2. Create a Boolean Variable named bolWifiSupported.
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 Wifi availability to a boolean named bolWifiSupported. It will then display a toast displaying the Wifi availability of the device to the user.
bolWifiSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI);
if (bolWifiSupported) {
Toast.makeText(this, "Device supports Wifi", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Device does NOT support Wifi!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_WIFI
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_WIFI