I spent much time by seaching for solution but without result. So my question is, is there any way how to detect whether device has 5Ghz Wifi or not? It would be nice if it's possible to achieve that. I already analysed WifiManager
but didn't find proper method or property.
Thanks in advance.
As of Android API Level 21, WifiManager has a method called is5GHzBandSupported()
that returns true if the adapter supports 5 GHz band.
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;
来源:https://stackoverflow.com/questions/18607371/how-to-detect-whether-device-has-5ghz-wi-fi-or-not