How to detect whether device has 5Ghz Wi-Fi or not

跟風遠走 提交于 2019-12-05 17:16:34

As of Android API Level 21, WifiManager has a method called is5GHzBandSupported() that returns true if the adapter supports 5 GHz band.

Roc Boronat

Our approach is to look for the results of a wifi scan and look for a signal of 5GHz. That's not a good solution, 'cause it would give false negatives, but if your context is a venue where you can assure that there are 5GHz wifis near you, it can solve the issue.

See: How can I get Android Wifi Scan Results into a list?

The data you can extract from a wifi scan (look for the frequency value):


(source: fewlaps.com)

Hope it helps!

I resolved this using below code snip

        WifiManager wifiManager= (WifiManager) mContext.getApplicationContext().getSystemService(WIFI_SERVICE);
        Class cls = Class.forName("android.net.wifi.WifiManager");
        Method method = cls.getMethod("isDualBandSupported");

        Object invoke = method.invoke(wifiManager);
        boolean is5GhzSupported=(boolean)invoke;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!