Simon Dorociak
Simon Dorociak

Reputation: 33515

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

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.

Upvotes: 4

Views: 12355

Answers (3)

Roc Boronat
Roc Boronat

Reputation: 12171

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): the data you can extract from a wifi scan
(source: fewlaps.com)

Hope it helps!

Upvotes: 1

Anis Ajmeri
Anis Ajmeri

Reputation: 11

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;

Upvotes: 1

Alan Kinnaman
Alan Kinnaman

Reputation: 926

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

Upvotes: 4

Related Questions