1

I am maintaining a small app related to wifi networks. It tests internet connectivity when the phone connected to a wifi network.

While testing and using the app in a place with two neighbouring wifi networks (different SSIDs) with slightly overlapping coverage with a HTC Desire running Android 2.2.2, the sequence of disconnecting and connecting when moving from wifi A to B seems to be:

  1. Disconnect from wifi A
  2. Connect to wifi B

Now with a Fairphone running 4.2.2, the sequence seems to be:

  1. Connect to wifi B
  2. Disconnect from wifi A

Does this mean that unlike the HTC Desire, the Fairphone does some sort of roaming and first connects to the wifi whose signal became stronger than the one of the current wifi connection, and then drops the "old" wifi connection?

I am asking this question because if my observations are correct, this has some implications on the app's behaviour, i.e. it should not consider the last wifi connectivity event but rather check the actual state of wifi connectivity regardless if the last event was "connected" or "disconnected".

Torsten Römer
  • 3,834
  • 4
  • 40
  • 53
  • 1
    Based on your observations, I think you should make the change in your code. Some crazy device could even have more than a single WiFi adapter, and your code would be prepared for it. – Merlevede Feb 19 '14 at 21:12
  • 1
    I have seen wifi behavior of a lot of different android phones. Different makes, different versions of Android, different wifi chips. There's a lot of differences between these. As a result, while the wifi behavior of a particular phone is predictable, between phones it is not. If your app depends on a particular wifi behavior, I suggest you test a sufficient number of phones with your app. – Christine Feb 19 '14 at 21:24
  • Thanks. As Merlevede suggests, I have already changed my code so it behaves on the actual state of wifi connectivity instead of the state reported by the latest wifi event, so it works regardless of any particular behaviour of a device, and my app's behaviour can be covered by unit tests :-) – Torsten Römer Feb 20 '14 at 22:38

1 Answers1

1

On android, as on many linux flavors, wpa_supplicant controls roaming behavior. You could look into it so to see what it is doing.

Specifically to answer your question, it is possible for a WLAN Device (in linux), to use different types of drivers:

  • SoftMAC: MLME (Media Access Control (MAC) Sublayer Management Entity) is managed in software.
  • FullMAC: MLME is managed in hardware.

Particularly some of the MLME functions are:

  • Authenticate
  • Deauthenticate
  • Associate
  • Disassociate
  • Reassociate

So differences are to be expected in some of this mechanisms on different devices and versions of Android (driver types, wpa_supplicant).

The correct 802.11 behavior for roaming is to send an Reassociation request to the newly selected AP. Clients that first Disassociate from an AP to later Associate with a new AP actually do not support 802.11 roaming and use some sort of fake-roaming through a SoftMac approach.

In standard roaming packets sent to a station do not get lost and are forwarded from one AP to the roamed AP in order for the roaming station to receive them.