Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports Wi-Fi Direct networking.
Constant Value: "android.hardware.wifi.direct"
Constant Value: "android.hardware.wifi.direct"
Here are some examples of Android Phones with Wi-Fi Direct.
1. Get a PackageManager Instance named myPackageManager.
1. Get a PackageManager Instance named myPackageManager.
2. Create a Boolean Variable named bolWifiDirectSupported.
3. Set the Minimum and Target SDK version to 14 or greater.
4. In the onCreate method, add the below code. This will return the Wifi Direct availability to a boolean named bolWifiDirectSupported. It will then display a toast displaying the Wifi Direct availability of the device to the user.
bolWifiDirectSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI_DIRECT);
if (bolWifiDirectSupported) {
Toast.makeText(this, "Device supports Wifi Direct", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Device does NOT support Wifi Direct!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_WIFI_DIRECT
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_WIFI_DIRECT