Android’s Greatest Flaw: Wifi Roaming

Android’s Greatest Flaw: Wifi Roaming

Over the years, like all operating systems, Android has had bugs uncovered and security flaws exposed.  As you would expect, over time the worst of these have all been steadily patched and updated to provide one of the best (Open Source!) mobile device platforms out there.  Unfortunately there’s one flaw that has never fixed, much to the frustration of a lot of users: that flaw is wifi roaming.

For the sake of clarity, let me explain what I mean by wifi roaming: essentially its a devices ability to intelligently select the best wireless access point to connect to at any give moment or put more simply: to connect to the strongest known signal.  The setup for a multi wifi access point (or router) wireless network that allows this is well known but here’s a quick summary:

Wifi Roaming Setup

Your access points or routers will need to be connected somehow – generally this is done via CAT5/6 network cable.

Setup up your wireless access points (or routers) with:

  • The same SSID (wifinetwork name)
  • The same security type (for example WPA2)
  • The same passphrase/wireless key
  • Ensure they are on different channels, ideally 1, 6 or 11

While a relatively simple exercise for most equipment (as proven by all laptops and non-Android devices that have passed through my home), Android devices seem to desperately cling on to whichever wireless network you told them to connect to last.

Defining the Problem

Wouter Smeltekop defines the problem very well on his post ‘WiFi roaming between AP’s with the same SSID‘ saying:

Situation:

I’m standing next to my WiFi access point downstairs, I have full signal bars and perfect connection. I then move upstairs (2 stories up) and move next to the AP located upstairs.

Expected behaviour:

The phone should notice that the AP it is connected to has very weak signal, barely 1 bar left near -85/-90 db which is hardly usable. On the next background scan it should also find the second AP has much better signal, around -45db and decide to ‘roam’ to the other AP.

Actual behaviour:

The phone maintains a persistent connection with the AP downstairs for hours and does not ‘roam’ to the AP upstairs causing bad connection and battery drain.

Example

Just to illustrate this, I use Wifi Analyzer on my Samsung Galaxy S4, as you can see from the image below, my phone insist on being connect to the access point with the lowest signal (it’s barely in range).

Wifi-Analyzer-Showing-Wifi-Roaming-Issue

 

To add insult to injury everytime I manually tell it to connect to the other Access Point (depending on which end of the house I’m in) it asks me to re-enter the password as though its an unknown network:

Android-Forgetting-Wifi-Password

The Solution

For the time being there are three potential solutions available, I’ll start with the simplest and work down to the most technical:

Solution 1: The App

The simplest solution is to install the free App “Wifi Roaming Fix” which forces the device to scan for (and connect to) a better access point on a schedule.  Battery life may be slightly reduced but as the App authors point out, being connected to an Access Point further away can also be a better drain.

Wifi Roaming Fix App

You can get App here at the Google Play store.

Solution 2: Edit Your Device Configuration

As Android devices have the ability to correctly scan and connect to the strongest access point – it’s just dorment (by accident or design, no one seems to know) it’s possible to re-activate it by editing the wpa_supplicant.conf supplicant file on your device.  This is not for the feint hearted but details can be found on the following pages:

http://forum.xda-developers.com/showpost.php?p=46134045&postcount=15357

https://productforums.google.com/forum/#!topic/nexus/93GcQ8O75q8

http://forum.xda-developers.com/galaxy-s3/general/fix-wifi-roaming-bug-t2015482

Solution 3: Reconfigure Your Wireless Network as a Mesh or WDS System

Another option is to reconfigure your wireless network as a Mesh (probably too expensive for most home users) or a WDS network.  I haven’t tried this solution yet but will be doing so shortly as its something I’ve wanted to play with and test for a while as a budget Mesh alternative.  As soon as I have, I’ll post a more comprehensive review.

TP-Link doing a fantastic range of wireless devices that support WDS, examples can be found here on Amazon:

TP-LINK TL-WA801ND Wireless N300 Access Point, 2.4Ghz 300Mbps, 802.11b/g/n, AP/Client/Bridge/Repeater, 2x 4dBi, Passive POE TP-LINK TL-WR843ND Wireless N300 AP/Client Router, 300Mpbs, WISP, IP QoS, WPS Button, Passive POE TP-LINK TL-WA901ND Wireless N300 Access Point, 2.4Ghz 300Mbps, 802.11b/g/n, AP/Client/Bridge/Repeater, 3x 4dBi, Passive POE
Bob McKay

About Bob McKay

Bob McKay works at Perfect Image, is a father, programmer and a self confessed techie-geek type.

Disclosure Policy

Bob on Google+

33 comments on «Android’s Greatest Flaw: Wifi Roaming»

  1. Ketan says:

    Thanks for the write-up. I found the Wifi Roaming Fix app (solution 1) independently but couldn’t understand why it would be necessary until I saw your article.

    I hope this gets fixed in a future version but am not holding my breath – other networking bugs have existed in Android for years from the early versions – such as the DHCP bug which results in wrong IP addresses being used by Android.

    I’m using a Moto G (1st gen) on KitKat 4.4.4.

    1. Bob McKay says:

      Hey Ketan,
      Thanks for the post, the frustrating thing is I have two Samsung KitKat devices and one works fine (my Galaxy Tab Pro) and the other requires the password be repeatedly reentered (my Galaxy S4).
      Bob

      1. Robert Callahan says:

        Hey Bob,
        Does the option in Settings-Developer Settings-Always Allow WiFi Roam Scans, being Enabled do the same thing for us Nexus 7 (2012) Rooted, and running 5.1.1 users? I have always left it off but after reading your article remembered the option.

        Thanks for informative articles!

        1. Bob McKay says:

          Hey Robert,

          Thanks for posting! I’m afraid I don’t know as I’m still running Kit Kat (waiting for an update, can’t root as I lose access to banking apps, etc).

      2. Edgerrin Cortijo says:

        Android 5.1 allows you to do this in the dev options.

  2. In Android 5, there is an option under Developer Options called “Allow Wifi Roaming Scans”. This option should fix this issue. (Although I don’t know why it’s disabled by default).

    1. Bob McKay says:

      Awesome – thanks Rusty, I’ll give it a go!

      1. Sean says:

        Did Developer Options->“Allow Wifi Roaming Scans” fix the issue for you?

        1. Bob McKay says:

          Hi Sean,

          Unfortunately my phone provider – three – still haven’t rolled out ‘Lollipop’ for my phone so I don’t have the option to try it!

          1. Agus Nurhalim says:

            Hi Bob, i confirmed that the developer option in Lollipop solved my wifi problems. I have various devices, old and new. Now, i am really curious how can i do the same for Jelly Bean and KitKat. As many of devices i have non upgradeable to Lollipop

  3. Phil says:

    Glad it’s not just me noticing this. We are using our phones as VoIP handsets and if you move throughout our building the call quality tanks as our devices just don’t want to move on to a different AP.

    I found solution one unreliable as it will often keep failing to connect to a point, yet if I disable/re-enable Wifi the phone will then connect.

    Ggrr

    1. Bob McKay says:

      Hi Phil,

      Yep this is driving me mad – in the past few weeks, my android tablet also started acting up. Two WIFI networks at opposite end of the house, same SSID, different channels, same password – my Galaxy Tablet Pro will NOT remember both of them at the same time. If I connect to one AP, when I walk to the other end of the house it refuses to connect to the other – if I force it, it asks for the password. GRRRR indeed!

      1. Robert Callahan says:

        I believe if you edit the WiFi file “system/data,misc/WiFi/wpa_supplicant scan” and change the “Priority” number to the SSID, you can at least manipulate the order in which the AP’s are chosen.

        * My post from a minute ago re: WiFi roam scan, should have read: Always Allow WiFi ROAM Scans..

  4. Bob says:

    Do you have any idea what “Always allow Wifi Roaming Scans” actually does? You said you would try it – did it work?
    The inability to wander around my house and Android to keep up with my various APs is very annoying. I have followed all of your links (#1 doesn’t work for me) but as usual on the internet they peter out in the usual “I don’t know why you’re moaning as it works for me” babel. Or the threads just peter out of their own accord.

    1. Bob McKay says:

      Hi Bob,

      Unfortunately my phone provider still haven’t rolled out ‘Lollipop’ for my phone so I don’t have the option to try it!

      1. Robert Callahan says:

        Update: The Always Allow WiFi Roam Scans option being Enabled in Setting gs-Developers Options worked for me as I traveled from one AP to another and my rooted Nexus 7 (2012) running 5.1.1 Lollipop dropped the fading AP and connected instantly to the newer and stronger AP closest to me.

    2. Anonymous says:

      The Always allow WiFi roaming scans does not work by the way. No idea what it is there to do as usual there is no info from Google regarding it either!

  5. Joe says:

    Always allow WiFi roaming scans on lollipop works for me. I use public xfinity wifi and when it’s not on and I turn on WiFi, the xfinity spot usually only shows one or two bars, 3 max. After I turn on roaming scan, automatically disconnects from the weak one and goes to a newer, stronger xfinitywifi public spot with full bars. Xfinity public WiFi has automatic login based off your devices MAC address so no need to login again, it’s automatic.

    1. Bob McKay says:

      Hey Joe,

      Thanks for the comment. I’m considering switching all my APs to Ubiquity APs as they are cheap, provide a scalable multi-AP wireless network and we’ve had good experiences with them.

  6. No Way; they hid it from users says:

    BOB,
    Ok. The “….allow WIFI roam scans…” from Developer Options worked on my Lolli Galaxy S4 from At&t. For a year and many months I looked for a solution as my home is 3 stories. Enabled 2 routers with all proper settings (same ssid and passwords). One router is 5 Ghz only. The other produces both 2.4 Ghz and 5Ghz. The Wifi-Roaming Fix app is useless and lacked consistency. Many bugs in my personal experience.

    I did come across your write up a while ago but didn’t want to try the 3rd method. Recently I came across your page once again and read about the Develop/Allow wifi scans option and have been using it and playing around with it for a couple of weeks. My results are as follows:
    1. It does what we were expecting it to do: switch to the strongest signal at around 75-65 db [per wifi analizer app].
    2. It works even better when you select the Smart Network Switch selection which picks best option between 5 Ghz, 2.4 Ghz, and mobile networks. I would never use this setting in the past cause on many instances, I would be home watching something online thinking I’m on wifi, but signal was weak and phone would be using data [high bills those days for my data usage]. At&t prob programed phones this way on purpose to increase data usage. So with both of these working together, now my phone always uses not only the strongest connection, but the one with best Ghz link speed.
    3. CONS: if you restart your phone, or it updates itself, restarts itself, or anything that makes the phone restart, will remove/clear your setting on the Developer Options screen. So I’m having to check on it every now and then to make sure the box is checked for wifi scans to happen.
    4. CONS. This setting might use more battery. But in my case, I don’t care cause my phone is nearly 2 years old and I’m having to have it plugged in almost all the time and everywhere. So I did not do a follow up on battery consumption. You be your own judges on this.

    I’m also about to change this phone for the S6 but feel much more comfortable getting it now that I KNOW it can do wifi roaming within multiple routers. Too bad I came about this information so late. It would’ve save me some money, restless nights searching online, and frustrations with app that didn’t work

    I hope this helps someone out there. Sorry for the length of it.

  7. Joseph Tole says:

    It seems to me that some of you may be misunderstanding some key points regarding what WiFi roaming is and how it works. Additionally, as far as WiFi roaming scanning, I think some of you may not fully understand what the hardware requirements are and that these requirements do not exist on all WiFi adapters and consequently do not exist on all phones so allow me to explain.

    Wifi roaming can only occur between Wireless Access Points (WAP) that are connected to each other in real time and are configured to be able to offer roaming. This is a feature you almost never see on home WAPs and is considered more of a enterprise / campus grade feature. You usually require a WiFi controller which is a separate piece of hardware and all WAPs are configured to use that controller. Additionally, some companies offer hosted roaming features (such as AeroHive) where the controller exists on the cloud and you subscribe to the roaming service. The WAPs connect to the manufacturers roaming service and you may a monthly fee to use it. When you have proper Wifi roaming set up, there is nothing you need to configure on any device to use it. There is nothing that can be set to use it. Once you connect to a network which allows roaming, it is handled entirely by the WAPs and the controller and a phone cannot do anything to affect that. When you pass a zone where you would begin to have a stronger connection from a newer WAP than the one you are currently connected to, the controller detects this via data sent from the WAPs and it coordinates for one WAP to stop sending data to you at the same millesecond that the new WAP should start sending data to you. This happens in a manner where it is almost invisible to a connecting device.

    When you set two “base stations” or home wifi routers or proper WAPs or whatever to have the same SSID, security type and password, you have not set up roaming. You have set up a manner for your device to move from one connection point to another connection point without re-authenticating to the wireless network but the new WAP that you are connecting to knows nothing about your previous connection. In fact you will have to re authenticate but your device, whether it’s a phone, laptop or whatever, will automatically re authenticate because due to the environment you have set up. This whole transaction though does require your device disassociates with the previous WAP and reassociates with the new WAP and this will cause a short outage time. If you are using a TCP based application such as watching a video on YouTube and if that video is not buffered enough or the buffer empties while you reassociate than there will be a delay. TCP is connection based and the reassociation time is usually shorter than the the TCP timeout time so typically no data will be lost. If you are using a UDP application with is commonly used with real time communications such as VoIP and video chat than you will probably lose data (silence during the VoIP call) and you may even get disconnected and have to reconnect.

    Because of the reassociation which must occur, it’s a best practice in wireless design that you do not reassociate with a new WAP until you no longer able to communicate with the WAP you are connected to. Remember that proper roaming does not require reassociation to a WAP and the connections transition from one WAP to another, automatically through the controller and because proper roaming does this at the WAP level instead of at the connected device level, this can happen without data loss and reassociation times. When you are not using proper roaming i.e. when you have only configured two WAPs to have the same SSID / password / security type, than your device will make the intelligent decision of not disassociating from the WAP you are connected to until that WAP is no longer usable. The WiFi hardware and software you are using does not know what software you are running and it would be bad design to have it interrupt your YouTube or VoIP chat only because it knows you may be receiving a better signal now from a completely different WAP than the one you are already connected to. Additionally, there is no way for your phone / laptop / etc to know if the other WAP with the same set up is even connected to the same network. As an example, you and your neighbor may have thought you were setting up roaming by configuring two routers with the same set up so you could “roam” the Internet when walking from one house to the other but your houses are not connected and if you are streaming something to/from your home network like Chromecast and you reassociate to another network with it’s own devices than suddenly your connection will be lost.

    All of the reasons above is why your phone does not “roam” the way you think it should roam and it’s specifically because you really are not implementing proper WiFi roaming in the first place.

    The last point I want to make is that any app which claims to be able to pre-emptively scan for networks, as well as the developer option “Allow Wi-Fi roaming scans” may not work as you expect because there is a good chance your WiFi adapter built into your phone, or laptop, whatever will probably not have the hardware requirements to do what you need. Almost all WiFi adapters will only support one radio per frequency. If you have a phone that only supports 2.4Ghz than it will, almost definitely, only have one radio for 2.4 Ghz. If you have a phone that supports 2.4Ghz and 5Ghz, it will also almost definitely have one radio for 2.4Ghz and one radio for 5Ghz. When you are associated with a WiFi connection, meaning your phone is connected to it and transferring data over it than your phone is using that radio for the connection. When it is using that radio for the connection than it is unable to switch to scan mode to search for other WAPs or connections. A WiFi radio will either be scanning for connections or associated with connections but one radio cannot do both simultaneously. Almost all phones are built to only have one radio per frequency as are consumer grade WiFi adapters such as the one built into your laptop and any you would buy from Best Buy, etc. Multi radio adapters are special case adapters that are typically used for network testing or development or other professional means. They are more expensive and end user consumers do not need them. Keep in mind that developer options are, as the name implies, designed for developers and should not be used casually by average users. That specific WiFi option is probably used by Android developers as well as software developers using emulated devices.

    I hope I have cleared a lot of this up for you.

    1. Daniel says:

      HI Joseph,
      Thank you for your explanation.
      I also have a problem with all the Android devices with two major wifi issue.
      Our deployment is enterprise campus deployment and the Android devices are not roaming seamlessly.
      But Apple devices and window devices roam perfectly.
      1. Android device stuck at obtaining IP address (need to turn off the wifi and turn on back)
      2. Need to turn on the wifi scan from developer mode. ( but this does not help completely and still disconnect in some points.) Also the setting disable once the device is rebooted.

  8. Joseph Tole says:

    Oh! P.S. Ubiquity UniFi WAPs do allow for true roaming using what they call Zero-Handoff. The premise is that it works the same as WiFi roaming from the point of view of how they connect to the device and how your device transitions from one WAP to another WAP. I’ve only read about this a couple months ago when I was considering purchasing them but I did not so I am unfamiliar with the details of how they accomplish this but I read good reviews that they do do it properly. I’ve also read that they can only do this after you upgrade the firmware but I don’t know if that’s still the case. It may be included in the models they sell now vs. then.

  9. Simon B says:

    Joseph – all very interesting but doesn’t help answer my (and the OPs) issue that flitting between APs on our home network seems to work fine for Windows laptops but is problematic on Android phones. Why should it be any differen?. Interestingly I have no issues on my Samsung android tablet but do on my Harrier android phone and both have 5.0.2. Go figure!
    The phone report’s no internet connect frequently when I have moved to the other end of the house, and I have to manually reconnect, after which it works without any problems.

  10. Radu T says:

    Agree with Simon BB to a degree. Joseph’s post is indeed very informative but equally unhelpful. I also noticed that, unlike Simon, despite my laptops and both my latest generation Android phones not “roaming”, my iPhones (4 and 4s) always seem to be able to switch seemlesly to the strongest WiFi signal. My home setup is a main WiFi router supplied by my ISP and aPowerline WiFi extender. Unless the iPhones have the extra bit of hardware which Joseph mentioned about, in which case his post makes perfect sense, there must be something else going on.

    1. Bob McKay says:

      Hi Radu,

      I agree – I guess it really depends on your exact definition of wireless roaming and I haven’t been able to find an authoritative one. What Joseph describes to me I would call WDS (or at a stretch, mesh) not Wifi Roaming which is the ability of the device to move from one wifi SSID to the other (hence roaming). For me, the “Always Allow Wifi Roaming Scans” tweak solved the issue and despite what Joseph says, this allows me to walk around with my phone jumping from one AP to another, keeping in the same IP address and with only a glitch in connectivity. The glitch to me is the only visible difference from a user perspective between this setup and a true mesh.

  11. matt says:

    Thank you for this article, and also thanks to the participants in the insightful discussion. This has been bothering me for months and I’m glad to be on the track of a solution.

    For what its worth, my now dead Nexus 5 navigated my 2 wifi router home configuration without having to reconnect most of the time, while the replacement Samsung S6 has had to always be told to switch. Both phones on Lolliop. Both routers using same ssid and pass phrase.

    1. matt says:

      “…on the track to a solution” :

      Nope. The developer option “Always allow roaming wifi scans” does not fix hanging on to a weak signal in presence of a strong one (on my phone anyway).

  12. John E says:

    I hope this is not too far off-topic. I have not found any info on my problem.

    Since my Galaxy core updated to Lollipop it won’t drop a weak data
    connection in favour of a strong wifi conection when I come indoors.

    Opening settings and WiFi seems to wake the device up and it then scans and
    connects.

    I’ve tried all sorts re-setting ploys without success. Has anyone got any ideas?

  13. Randy says:

    Question: If “Always allow wifi roaming” is enabled under Dev settings on Lollipop, will that affect battery use even when WIFI is disabled? Or does this feature recognize when the antenna is shut off, and stop scanning for roaming changes?

    1. Bob McKay says:

      Hi Randy,
      I’m no expert but I would assume there’ll be no battery hit as the whole wifi stack will be disabled

  14. MJ says:

    I know this thread is a little old, but wanted to share this point.
    With the Ubiquiti WAPS as mentioned before, they manage the whole fully meshed work for you, and if you walk around with your laptop, it will jump from one wap to another the way we expect it to. They are solid and I have in some locations 15-20 of them all meshed and they work great.

    I do see that with Android, this isn’t the case, it does fall in love so to speak with the wap it connects to initially and doesn’t let go…. Have a tech trying the developer option now on site and it will probably resolve the roaming from the Android side.

    1. Steve says:

      MJ, Also note that only the old generation Ubiquiti WAPs do their proprietary Zero Latency Handoff. The newer range don’t. I have been trying to determine whether they do 801.11r and preauthorisation (which is the Standards based way to do roaming) but I have not yet got an answer.
      Steve

Leave a Reply

Your email address will not be published. Required fields are marked *