Get Wi-Fi protocol (802.11a/b/g/n) programmatically

前端 未结 2 1599
悲&欢浪女
悲&欢浪女 2021-01-17 09:01

Through WifiManager, my Android app can get a lot of details about Wi-Fi. However I fail to get protocol type like a/b/g/n. I have a client requirement to do that.

2条回答
  •  遇见更好的自我
    2021-01-17 09:24

    You can partially deduce the protocol from the link speed

    WifiManager.getConnectionInfo().getLinkSpeed()

    By Wikipedia 802.11 protocols speed table you can tell if it is 802.11b, 802.11n or 802.11ag.
    802.11n and 802.11ac full link speed tables

    Link speeds of protocols 802.11a and 802.11g are the same, you can distinguish between them by the used frequency (5GHz or 2.4GHz) in the scan results.

    Note that protocol can change during the connection, client and access point do negotiate protocols and speeds but they agree on a list and not on one specific speed.

    I don't think there is a way to distinguish between 802.11n and 802.11ac in their overlapping speeds.

提交回复
热议问题