Location Management: Best Practices (Android)

Prev Next

Introduction

Reliable, efficient, and responsive geofencing begins with striking the right balance between accuracy, power consumption, and user experience. Design geofences with sufficient size, ensure proper device settings, maintain stable connectivity, and account for short but expected delays in triggering. With the right configuration and Android tools, you can achieve consistent and dependable location performance across devices.


Key Guidelines

  • Use a minimum geofence radius of 100 m (recommended: 150 m) for consistent detection.

  • Expect short delays between entering/exiting an area and receiving alerts:

    • Usually under 2 minutes, faster when moving.

    • Around 2–3 minutes under Background Location Limits.

    • Up to 6 minutes if the device has been idle for a long period.

  • Keep Wi-Fi or scan-only mode enabled to improve location accuracy, even when the app isn’t using Wi-Fi directly.

  • Maintain a reliable data connection, as a network-based location requires internet access.

  • Optimize location and scanning settings through the SettingsClient and Settings Panels on Android 10+.


Troubleshooting and Optimization

1. Verify Geofence Setup

  • Ensure geofences are properly registered and active.

  • Follow Android’s official troubleshooting guidance for geofencing events.

2. Validate Device Settings

  • Confirm Location is enabled and appropriate scanning options are active.

  • Use SettingsClient to detect and prompt users to correct suboptimal settings.

3. Refine Geofence Design

  • Increase radius (≥100–150 m) if alerts are missed.

  • Prefer fewer, broader geofences over many small ones.

4. Account for Latency

  • Plan user experience and background workflows around expected alert delays.

  • Expect longer latency when devices are idle or restricted by background limits.

5. Ensure Network Availability

Verify data connectivity is stable within the geofence area.


Configure Location Settings

Android 9.0 and later

  1. Open Settings.

  2. Tap Security & Location > Location (or Advanced if using a work profile).

  3. Toggle Location on/off under Location.

  4. Go to Advanced > Scanning and turn on Wi-Fi scanning and Bluetooth scanning.

  5. Under Advanced > Google Emergency Location Service, make sure the service is on.

Android 4.4 – 8.1

  1. Open Settings.

  2. Tap Security & Location > Location (or simply Location if that option is visible).

  3. Tap Mode, then choose:

    • High accuracy: Uses GPS, Wi-Fi, mobile networks, and sensors (Google Location Services).

    • Battery saving: Uses Wi-Fi and mobile networks only.

    • Device only: Uses GPS exclusively (slower, higher power consumption).


Best Practices for Implementation

  • Rely on network location for geofence triggers to save power and work indoors.

  • Prompt users to enable Wi-Fi or scanning options if they are currently disabled.

  • Use modern APIs (SettingsClient, Settings Panels) for permission and settings flows.