As per the Suggestion, Created CLBackgroundActivitySession and CLServiceSession in foreground to keep Core Location active.
Recreated those sessions on background launch/APNS.
Persisted and restored fence definitions so CLMonitor can re‑register fences after background launch.
But the restore only re‑registers fences that were already created before. If a fence is first created while the app is terminated and only launched in background, CLMonitor did not deliver the initial “enter” until a foreground session exists.
Comparision with old CLLocationManager region monitoring:
Old API (CLLocationManager region monitoring) is system‑managed. The OS keeps monitoring even when your app is terminated, and it can accept new region registrations in background because that API was designed around long‑standing background delivery.
New API (CLMonitor with CLBackgroundActivitySession/CLServiceSession) is session‑based. Apple expects the session to be created in foreground and then restored in background. It’s optimized for power and privacy, so first‑time background registration is not guaranteed; the system can defer or suppress events until the app has foreground‑initiated sessions.
Is there a modern API that reproduces the legacy CLLocationManager behavior of triggering an initial state event (Entry/Exit) while the app is in the background
Topic:
App & System Services
SubTopic:
Maps & Location
Tags: