How to Avoid WiFi Throttling on Android Devices

Continuing the discussion about Google’s limitations and how to bypass them

Elvina Sh
Elvina Sh
Oct 21 · 3 min read
Drawing of fish swimming to the surface
Drawing of fish swimming to the surface
Photo by Gaspart on Dribbble.

Today, I want to discuss WiFi scan throttling in new Android versions and how to avoid it. Previously, I wrote an article about a new scan mechanism on the recently released Android R. If you read that article, you know that Google limits developers’ opportunities to scan WiFi as in previous Android versions.

So let’s start our article by reviewing how it worked earlier and how to get similar results now with new Android R.

How It Worked Earlier

This part of the article will be simple and without any restrictions. There were not any restrictions including Android Oreo and you could scan every second without any throttling. Here is a simple code snippet explaining how it worked earlier:

You just register the broadcast receiver in your context for getting scan results and parse them. Then you call the start scan method on your WiFi manager and it works like a charm. There was a time when Android allowed scanning WiFi up to ten times per second. Just imagine the potential that opens up for high-quality navigation.

But then everything went wrong and Google introduced WiFi scan restrictions.

Android 9 and 10

Upon the release of Android 9, Google presented a surprise to all developers. The WiFi scan was cropped as much as possible. Now you can start the scan only four times every 120 seconds. If you try to start the scan more times, then all your attempts will be throttled.

In my previous article, I described a solution for scanning with equal intervals and working with WiFi RTT, but it’s worth noting that you cannot avoid throttling altogether.

By the way, Google introduced a solution with the release of Android 10. They added a button that allows you to turn off the WiFi scan throttling in the Developer settings, so now you can turn it off and scan without restrictions. But if you write the common solution for all the devices, then you will not know if this option is turned off or not. And the main problem is devices with a custom OS (e.g. Huawei, Xiaomi, etc.) because they do not have the option for turning off throttling.

Android R and the Solution

Android R was released a few weeks ago and Google introduced the new scan because the old one was deprecated with the release of Android 9. So now they added a function for checking if the throttling is turned off:

You just need to check that throttle is disabled and you can scan without any restrictions. By the way, this solution is only good if you test your local application. For distributing it through Play Market and other platforms, this solution could be very bad because users will need to turn on the Developer mode and find this option there.

Conclusion

Google restricted frequent WiFi scans but added the option for turning off throttling. It looks like they understood their poor decision-making and are trying to somehow fix it. However, this still creates difficulties for both developers and users.

On the other hand, there is no way to scan WiFi on iOS at all, so we should be grateful for what we have.

Better Programming

Advice for programmers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store