How can i check my android device support wifi direct?

android, android-wifi, wifi

Solution

you should check in this way, because some devices do not support WiFi direct but still keep the WifiP2pManager code in framework.

private boolean isWifiDirectSupported(Context ctx) {
    PackageManager pm = ctx.getPackageManager();
    FeatureInfo[] features = pm.getSystemAvailableFeatures();
    for (FeatureInfo info : features) {
        if (info != null && info.name != null && info.name.equalsIgnoreCase("android.hardware.wifi.direct")) {
            return true;
        }
    }
    return false;
}

Problem

I am working with android wifi direct demo application. After installation in my device I noticed that it is not working as expected. I am confused, does my device support wifi direct or special hardware feature required for wifi direct? My device is local walton brand and API level 16. After reading android documentation i know that Wi-Fi Direct added in API level 14 doesn't need a wireless access point. My other question is if in a place where no wifi zone is created using wifi direct two or more device communicate with each other. in summing my problem, i need to know if my device not support wifi direct what i do to run wifi demo. Thanks in advance.

Original source