WifiManager.is5GHzBandSupported() lying?
Asked Answered
T

1

9

I am using new method is5GHzBandSupported() available in WifiManager since API level 21.

http://developer.android.com/reference/android/net/wifi/WifiManager.html#is5GHzBandSupported%28%29

On my Nexus 5 it is working fine (returning yes as expected), but

  • on my Samsung Galaxy S4 advance (GT-I9506) running official Android ROM in version 5.0.1, it is returning false, WHICH IS APPARENTLY INCORRECT, since this device does effectively support 5ghz...
  • same thing for my nexus 7 2013, also returning NO, which is also false

Has anybody seen this behaviour also on other models, is it a rom issue very specific to these model, or is it a misunderstanding of behaviour of this method?

Transpolar answered 8/7, 2015 at 8:59 Comment(1)
Apparently this is not part of compatibility test suite (source.android.com/compatibility/overview.html) so it is not reliable... well in fact it is partly reliable if you understand it as : true ==> supported, false ==> maybe... sicTranspolar
L
0

Use below code snip to detect whether device support 5Ghz band or not.

    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;
Louden answered 29/4, 2017 at 12:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.