I am implementing geofencing using Android Geofencing API.
When a user enters an airport location, the app should trigger a notification — even if the app is in background or killed.
What I tried:
Used GeofencingClient to register geofence
Added required permissions:
ACCESS_FINE_LOCATION
ACCESS_BACKGROUND_LOCATION
Tested on Android 12 device
GEOFENCE_TRANSITION_ENTER
INITIAL_TRIGGER_ENTER
BroadcastReceiver via PendingIntent
Radius ~2–3 km
Permissions:
ACCESS_FINE_LOCATION
ACCESS_BACKGROUND_LOCATION
✅ Works when app is in foreground
❌ Not triggering when:
app is in background
app is killed (swiped away)
BroadcastReceiver is not called in those cases.
Is this expected behavior on newer Android versions?
Are there any restrictions that prevent geofencing from working when the app is killed?
What is the recommended approach to reliably detect location entry (like airport detection) in background?
I am looking for a solution that works reliably on Android 10+ devices.