Is there any way to start a live activity from a geofence trigger?

Hello, we have an app that has a case where the user can turn on a feature that starts a timer for a thing when they arrive at a specific location.

Our app also has a live activity to show the timer.

Naturally, we're trying to make our live activity to start counting when the geofence triggers, but we get ActivityAuthorizationError.visibility. If an activity is already running, it's possible to turn it off.

So, our question is basically if there's any way to make the geofence trigger start our live activity?

Thanks

Answered by Engineer in 803767022

ActivityAuthorizationError.visibility will be returned if the app tries to start the Live Activity while it was in the background.

A geofence trigger will only activate your app in the background, hence it will not be "visible". You cannot start a Live Activity while an app is in the background.


Argun Tekant /  DTS Engineer / Core Technologies

Accepted Answer

ActivityAuthorizationError.visibility will be returned if the app tries to start the Live Activity while it was in the background.

A geofence trigger will only activate your app in the background, hence it will not be "visible". You cannot start a Live Activity while an app is in the background.


Argun Tekant /  DTS Engineer / Core Technologies

You can send an API call to your server from the background which can in turn send a push notification to the device and start your Live Activity, but you cannot explicitly do this in your app. I believe once the geofence is activated you have ~10 seconds to do something (in your case, send a request to your server to send back a push notification).

Rico

WWDR - DTS - Software Engineer

Rico, thanks for response. That's a great hack :) It feels strange though to go through all those hoops and unnecessary server traffic for a local-only need, when it could be solved by letting the user give the app permission or something. It could be a dialog like it is for live activities now, but for background initializations?

Is there any way to start a live activity from a geofence trigger?
 
 
Q