Geofence not triggering in background or when app is killed on Android 10+

1 day ago 1
ARTICLE AD BOX

I am implementing geofencing using Android Geofencing API.

Requirement

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

Setup

GEOFENCE_TRANSITION_ENTER

INITIAL_TRIGGER_ENTER

BroadcastReceiver via PendingIntent

Radius ~2–3 km

Permissions:

ACCESS_FINE_LOCATION

ACCESS_BACKGROUND_LOCATION

Issue

✅ 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.

Questions:

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.

Read Entire Article