Common Location Services Bugs and How to Catch Them

Common Location Services Bugs and How to Catch Them

April 08, 2026 · 19 min read · Common Issues

Common Location Services Bugs and How to Catch Them

Location‑aware features are now a baseline expectation for mobile and web apps. When the underlying location service misbehaves, users see wrong maps, missed check‑ins, broken geofences, or battery drain that leads to uninstalls. This guide walks through the most frequent location‑service defects, explains why they arise, shows how they appear to real people, and gives repeatable steps to reproduce, detect, and fix each one. A test matrix at the end lets you compare manual checks with automated approaches, and a short checklist helps you bake prevention into every release.

1. How Location Services Work on the Platforms You Target

Before hunting bugs, you need a mental model of what the OS actually provides.

1.1 Android Location Architecture

Android abstracts location sources into providers: GPS (satellite), Network (Wi‑Fi/cell tower), and Passive (updates from other apps). The LocationManager API delivers Location objects that contain latitude, longitude, altitude, accuracy (horizontal radius in meters), speed, bearing, and a timestamp. Apps request updates with a combination of interval, fastest interval, priority (PRIORITY_HIGH_ACCURACY, PRIORITY_BALANCED_POWER_ACCURACY, PRIORITY_LOW_POWER, PRIORITY_NO_POWER), and smallest displacement. The system may throttle or stop updates based on battery‑optimization settings, foreground/background state, and user‑granted permissions (ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, ACCESS_BACKGROUND_LOCATION on Android 10+).

1.2 iOS Location Architecture

iOS uses CLLocationManager. Authorization levels are whenInUse, always, and never. The manager delivers CLLocation objects with similar fields (coordinate, altitude, horizontalAccuracy, verticalAccuracy, speed, course, timestamp). You set desiredAccuracy, distanceFilter, and activityType to influence power usage. Background location requires the location background mode and proper usage strings in Info.plist. iOS also imposes deferred updates and pause‑resume behavior when the device thinks the user is stationary.

1.3 Web Geolocation API

In browsers, navigator.geolocation.getCurrentPosition(success, error, options) and watchPosition expose a promise‑based interface. The options object lets you request enableHighAccuracy, timeout, and maximumAge. The API returns a Position object with coords.latitude, coords.longitude, coords.accuracy, coords.altitude, coords.altitudeAccuracy, coords.heading, coords.speed, and a timestamp. Permission prompts are shown by the browser; the site can only receive updates while the page is visible or has a service worker that maintains a background fetch (limited).

Understanding these fundamentals helps you spot where assumptions break: treating accuracy as a guarantee, ignoring provider switches, or forgetting that background behavior differs between platforms.

2. Bug Pattern 1 – Permission Denial Mis‑handling

2.1 Why It Happens

Developers often request location at app start and assume the callback will fire. If the user denies permission, the location manager returns an error (onProviderDisabled on Android, didFailWithError with kCLErrorDenied on iOS, or a PositionError with PERMISSION_DENIED on the web). When the error is ignored or swallowed, the UI shows stale data, a loading spinner that never resolves, or a silent failure that breaks dependent features (e.g., “Find Nearby Stores”).

2.2 User‑Visible Symptoms

2.3 Reproducing the Bug

  1. Install the app on a clean device or emulator.
  2. Launch the app and immediately deny the location permission when prompted.
  3. Observe whether the UI shows an error message, falls back to a default location, or hangs.
  4. Repeat after granting permission to confirm the happy path works.

On the web, open the page in incognito mode, block location in the site settings, then reload.

2.4 Detection Strategies

Manual: Use the device’s settings to revoke location permission while the app is running, then trigger a location‑dependent action.

Automated:

2.5 Fix & Prevention

3. Bug Pattern 2 – Stale Cached Location

3.1 Why It Happens

Location APIs often return a cached location when no fresh fix is available quickly enough (e.g., indoor start‑up, GPS disabled). If the app treats that cached value as current without checking its age or accuracy, decisions based on distance, geofence entry/exit, or weather data become wrong.

3.2 User‑Visible Symptoms

3.3 Reproducing the Bug

  1. Start the app outdoors with a good GPS fix, note the latitude/longitude.
  2. Move indoors or turn off GPS/Wi‑Fi, then immediately trigger a location‑dependent action (e.g., refresh a nearby‑places list).
  3. Compare the returned location’s timestamp to the current time; if it’s older than a few minutes and the app still uses it, you have reproduced the stale‑cache issue.

3.4 Detection Strategies

Manual: Use a location‑spoofing app (Android: Fake GPS Location; iOS: Xcode’s GPX track) to simulate movement, then disable the spoof and watch the app’s reported position.

Automated:

3.5 Fix & Prevention

4. Bug Pattern 3 – Incorrect Coordinate Conversion

4.1 Why It Happens

Many apps need to display locations on a map that uses a different datum (e.g., converting from WGS84 latitude/longitude to Web Mercator for tile URLs, or to a local grid like UTM for distance calculations). Mistakes in the conversion formulas—mixing radians and degrees, using the wrong earth radius, or forgetting the sign of longitude—lead to placements that are off by kilometers or even placed in the wrong hemisphere.

4.2 User‑Visible Symptoms

4.3 Reproducing the Bug

  1. Pick a known coordinate pair (e.g., Statue of Liberty: 40.6892° N, ‑74.0445° W).
  2. Feed it into your conversion routine and compare the output to a trusted library (e.g., proj4js, GeographicLib, or Android’s Projection).
  3. If the result deviates beyond the expected tolerance (usually < 1 m for projection errors), you have a conversion bug.

4.4 Detection Strategies

Manual: Use a spreadsheet to compute expected values with a trusted formula and compare against your code’s output for a set of edge‑case points (poles, equator, anti‑meridian, extreme latitudes).

Automated:

4.5 Fix & Prevention

5. Bug Pattern 4 – Background Location Throttling

5.1 Why It Happens

Both Android and iOS aggressively limit background location to preserve battery. Android may switch from PRIORITY_HIGH_ACCURACY to a passive mode after a few minutes, or stop updates entirely if the app is in a background‑restricted bucket. iOS may deliver deferred locations or pause updates when the system detects the device is stationary. If your app assumes a constant update interval (e.g., every 5 seconds) for tracking a workout, you will see gaps in the recorded trace.

5.2 User‑Visible Symptoms

5.3 Reproducing the Bug

  1. Start a location‑tracking session in the foreground, verify you receive updates at the requested interval.
  2. Press the home button or switch to another app to move the app to the background.
  3. Wait 2‑3 minutes, then bring the app back to the foreground and inspect the location log. You should see a gap or a significant increase in the distance between consecutive points.

On iOS, enable “Background App Refresh” off for the app to exacerbate throttling.

5.4 Detection Strategies

Manual: Use the device’s battery‑usage screen to confirm the app is in a background‑restricted state, then observe location logs.

Automated:

5.5 Fix & Prevention

6. Bug Pattern 5 – Mock Location Interference

6.1 Why It Happens

During development, testers often enable mock locations (Android: Settings > Developer options > Select mock location app; iOS: Xcode GPX simulation) to simulate routes without moving. If the production code does not distinguish real from mock locations, a tester may inadvertently ship an app that trusts fake data, leading to wrong geo‑fences, incorrect weather, or misleading analytics. Moreover, some malicious apps can inject mock locations to spoof a user’s whereabouts (e.g., cheating in location‑based games).

6.2 User‑Visible Symptoms

6.3 Reproducing the Bug

  1. Enable mock locations on a test device and select a simple GPX route that moves from point A to point B.
  2. Run the app and observe the location stream.
  3. Disable mock locations and repeat the same physical movement (or use a real‑world walk).
  4. If the app’s behavior differs (e.g., triggers geofences only with mock data), the code is not guarding against mock locations.

6.4 Detection Strategies

Manual: Toggle the mock location setting and watch for changes in UI or analytics events.

Automated:

6.5 Fix & Prevention

7. Bug Pattern 6 – Accuracy Reporting Issues

7.1 Why It Happens

Developers sometimes treat the accuracy field as a guarantee that the true position lies within that radius. In reality, accuracy is an estimate; outliers can occur, especially in urban canyons or indoors where Wi‑Fi‑based fixes jump. If your app draws a fixed‑size circle or triggers an action when the estimated position enters a geofence, you may experience false positives/negatives.

7.2 User‑Visible Symptoms

7.3 Reproducing the Bug

  1. Stand in a known location with a strong GPS signal, note the accuracy value (often < 10 m).
  2. Move to a spot with poor reception (e.g., underground parking) and observe the accuracy value increase dramatically.
  3. Trigger a location‑dependent action that uses a fixed radius (e.g., “if distance < 50 m then show offer”). If the action fires despite the large accuracy, you have reproduced an accuracy‑trust bug.

7.4 Detection Strategies

Manual: Use a signal‑blocking pouch or move between open sky and indoor areas while watching the accuracy value in logcat (adb logcat | grep Location) or console.

Automated:

7.5 Fix & Prevention

8. Bug Pattern 7 – Geofence Trigger Failures

8.1 Why It Happens

Geofences rely on the OS to monitor transitions across a circular region. Common pitfalls include: registering too many geofences (Android limits to 100 per app), using an excessively small radius (less than the minimum detectable distance, often ~ 50 m on Android, ~ 10 m on iOS), failing to handle GEOFENCE_TRANSITION_DWELL correctly, or not accounting for the delay between crossing the boundary and receiving the callback (which can be several seconds to minutes).

8.2 User‑Visible Symptoms

8.3 Reproducing the Bug

  1. Register a geofence with a radius of 10 m (below the platform’s practical limit).
  2. Walk across the boundary at a normal pace.
  3. Observe whether the onGeofenceTransition (Android) or didEnterRegion / didExitRegion (iOS) fires.
  4. Increase the radius to 100 m and repeat; the event should now fire reliably.

8.4 Detection Strategies

Manual: Use a GPS‑trace app to record your path, then compare the timestamps of actual crossing with the timestamps of received geofence callbacks.

Automated:

8.5 Fix & Prevention

9. Bug Pattern 8 – Network Provider Fallback Errors

9.1 Why It Happens

When GPS is unavailable, Android may fall back to the network provider (Wi‑Fi/cell tower). This provider is less accurate and can sometimes return a location that is wildly incorrect (e.g., placing you in a neighboring city) if the cell tower database is stale or the Wi‑Fi access point list is outdated. If your app treats the network provider as interchangeable with GPS, you may see sudden jumps in the tracked path.

9.2 User‑Visible Symptoms

9.3 Reproducing the Bug

  1. Start the app outdoors with a solid GPS fix.
  2. Move into a location where GPS is blocked (e.g., a metal‑framed elevator) but Wi‑Fi is available.
  3. Watch the location updates; if the latitude/longitude jumps to a point corresponding to the Wi‑Fi router’s known location (often the ISP’s headquarters), you have observed a bad network fallback.

9.4 Detection Strategies

Manual: Disable GPS via developer options (Settings > Developer options > Mock GPS off and turn off GPS switches) while keeping Wi‑Fi on, then observe the location stream.

Automated:

9.5 Fix & Prevention

10. Bug Pattern 9 – Timezone/Date‑Time Misalignment from Location

9.1 Why It Happens

Some apps derive the local timezone from the device’s location (e.g., showing event times in the user’s current zone). If the location service returns a stale or incorrect coordinate, the inferred timezone can be wrong, causing schedule displays to shift by an hour or more. This is especially problematic for travel apps, calendar integrations, and financial apps that timestamp transactions.

9.2 User‑Visible Symptoms

9.3 Reproducing the Bug

  1. Set the device’s timezone manually to a known value (e.g., America/New_York).
  2. Spoof the location to a point in a different timezone (e.g., latitude/longitude in London).
  3. Observe whether the app updates its displayed times to match the spoofed location’s timezone or sticks to the device’s manual setting.

If the app follows the spoofed location despite the user’s explicit timezone preference, you have a location‑driven timezone bug.

9.4 Detection Strategies

Manual: Change location via a mock GPX route while watching the clock in the app; compare to the system clock shown in the status bar.

Automated:

9.5 Fix & Prevention

11. Bug Pattern 10 – Battery Optimizer Killing Location Updates

10.1 Why It Happens

Aggressive battery‑saver modes (Android’s Battery Optimization, iOS’s Low Power Mode, or manufacturer‑specific apps) can suspend background services, throttle alarms, or stop location updates altogether to extend battery life. If your app assumes that a started location service will keep running, you may see the tracking stop silently after the device enters a power‑saving state.

10.2 User‑Visible Symptoms

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free