Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

Does anyone know how to achieve that? (I don't have the option to use adb). It is to be done programmatically. I strongly believe that device and router have already negotiated protocol before they can connect. So that information is there with device. Question is, how do we get it?

like image 975
TorukMakto Avatar asked Sep 23 '13 18:09

TorukMakto


People also ask

What is Wi-Fi 802.11 a/b/g/n ac?

The five Wi-Fi (802.11) technologies (a, b, g, n and ac) are often abbreviated BGN, ABGN and A/B/G/N/AC in the specifications for wireless routers, Wi-Fi access points and the Wi-Fi in portable devices. For example, "N" means 802.11n.

What is protocol Wi-Fi 4 802.11 N?

802.11n (Wi-Fi 4)The first standard to specify MIMO, 802.11n was approved in October 2009 and allows for usage in two frequencies - 2.4GHz and 5GHz, with speeds up to 600Mbps. When you hear wireless LAN vendors use the term “dual-band”, it refers to being able to deliver data across these two frequencies.

How do I know if I have 802.11 N?

Go to the Network and Sharing Center and select Change Adapter Settings. Right-click your wireless adapter and click "Status". It should say somewhere there whether you're using Wireless-N, Wireless-G, etc.


1 Answers

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.

like image 79
Ofir Luzon Avatar answered Sep 30 '22 18:09

Ofir Luzon