MAVLINKGPS

The WiFi Scan Throttle

Why Indoor GPS Lags

Users often notice that while outdoor GPS updates at 5-10Hz, the indoor "Network Fusion" position sometimes stutters or updates slowly (e.g., once every 30 seconds). This is not a sensor failure; it is an Android battery preservation feature.

The "4 Scans per 2 Minutes" Rule

Starting with Android 9 (Pie), Google introduced strict limits on how often an app can trigger a WiFi scan, even when in the foreground.

The Source Code

The logic is enforced in the system's ScanRequestProxy.java.

  • Foreground Apps: Limited to 4 scans every 120 seconds.
  • Background Apps: Limited to 1 scan every 30 minutes.
// From com.android.server.wifi.ScanRequestProxy.java
public static final int SCAN_REQUEST_THROTTLE_TIME_WINDOW_FG_APPS_MS = 120 * 1000;
public static final int SCAN_REQUEST_THROTTLE_MAX_IN_TIME_WINDOW_FG_APPS = 4;
public static final int SCAN_REQUEST_THROTTLE_INTERVAL_BG_APPS_MS = 30 * 60 * 1000;

The Impact on Flight

If you are flying indoors using WiFi RTT or standard WiFi triangulation:

  1. The app requests a scan. Position updates.
  2. App requests another. Position updates.
  3. App requests a fifth scan. Blocked.
  4. The drone's position "freezes" for the next ~110 seconds until the throttle window resets.

The Fix: Developer Options

For reliable indoor flight, you MUST disable this throttling.

  1. Enable Developer Options (Tap Build Number 7 times).
  2. Find "WiFi scan throttling" (under Networking).
  3. Turn it OFF.

This allows MAVLink GPS to scan as fast as the WiFi chip allows (typically 1-2Hz), ensuring smooth position updates.

Source Code Reference