Design Geofence Enter and Exit Triggers for Android Apps
Last updated: November 29, 2026
Quick Overview
Design a geofencing service where apps register circular regions (for example a store or a home) and receive enter, exit, and dwell events when the user's device crosses them, for hundreds of millions of devices with tens of geofences each.
0
0
0 solved
Design a geofencing service where apps register circular regions (for example a store or a home) and receive enter, exit, and dwell events when the user's device crosses them, for hundreds of millions of devices with tens of geofences each.
Android geofencing APIs must balance accuracy, battery, and scale, and an interviewer for location platform teams will push on where computation lives. The checks are on spatial matching, hysteresis to avoid flapping, and device-versus-server split.
What the Interviewer Expects
- Decide what runs on device versus on the server
- Index geofences spatially for fast point-in-region matching
- Use hysteresis and dwell times to avoid flapping events
- Deliver events reliably to apps even when they are not running
- Respect permissions and per-app limits
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- Why not stream every location fix to the server?
- How do you handle GPS jitter at the boundary?
- What happens to geofences when location permission is revoked?
- How would you support polygon geofences?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
- Apps register geofences (center, radius, transitions of interest, expiry). Per-app limit around 100 per device.
- Events: ENTER, EXIT, DWELL (inside for N minutes). Latency target about 1 to 2 minut...
High-Level Design
Hybrid design:
- On device: a system location service holds all registered geofences for that device in a small spatial structure and evaluates them against location fixes from low-power sources (...