How often does Android system scan Wi-Fi?
In following 2 cases:
When device is connected to a network
or
When device is not connected to any network. Is it different from android OS version?
Is there any one know about that information?
How often does Android system scan Wi-Fi?
In following 2 cases:
When device is connected to a network
or
When device is not connected to any network. Is it different from android OS version?
Is there any one know about that information?
How often does Android system scan Wi-Fi?
It depends on the application implementation and on the Android OS version (so yes is the answer to your second question).
Let's go more in the details:
you can use an instance of WifiManager
to start your wifi scan by startScan()
method. Thats could allow you to start all the scans you want, draining battery very fast.
Is for this reason that from Android 8.0 (API 26) there are restrictions on scan frequency.
The following limitations apply to the frequency of scans using WifiManager.startScan().
Android 8.0 and Android 8.1:
Each background app can scan one time in a 30-minute period.
Android 9 and later:
Each foreground app can scan four times in a 2-minute period. This allows for a burst of scans in a short time.
All background apps combined can scan one time in a 30-minute period.
Android system scans wifi :
1. If device has wifi enabled and device is not connected to any network, it scans for available network
2. If device is connected to network then system will scan available network on request from user (i.e. when user clicks scan button)
WiFi scanning is essentially dependent on the hardware manufacturer - along with maybe some user settings and other apps that are running (other apps may request scans for WiFi networks). So there really isn't a "standard scan time" for WiFi.
Here is a good reference that talks about the interval between WiFI scans (essentially saying that you should check with the user to see if they want a "scan as often as possible" option, or something else...) What interval should I use between each WiFi scan on Android?
Unless your app is for developers, you should probably use a decaying algorithm, like check at 5 seconds, then 10, 20, 40, 80, 160... etc. until you max out at an acceptable timeframe (like 5 minutes - 300 seconds; or 1 hour - 3600 seconds). Then also monitor other events like phone sleep/wake or app launch. Use those to do WiFi polling - and try to connect and restart the decaying algorithm approach.
From my experiments on a LG G2 (Android 5.0.2), the wifi is scanned in the following situations :
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, minTime, ...)
. When specifying a minTime
of 0 ms, the network scan is done every 20 seconds.The App "Wifi Scan Interval" reveals that minimum/maximum/average wifi scan frequency greatly varies with the phone manufacturer and model. But it could be because of the installed applications. Based on that, I would guess that the rules above may be different for other phones.