How can i check my android device support wifi direct?

后端 未结 5 1386
甜味超标
甜味超标 2021-02-03 16:19

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 supp

5条回答
  •  你的背包
    2021-02-03 16:48

    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;
    }
    

提交回复
热议问题