Results & Errors

Results & Errors

Every call returns a LiveActivityResult:

when (val result = liveActivities.start(request)) {
    is LiveActivityResult.Success -> result.value          // LiveActivity
    is LiveActivityResult.Failure -> result.error          // LiveActivityException
}

LiveActivityException subtypes carry a stable numeric code:

CodeTypeWhen
2001UnsupportedPlatform, OS version, or missing iOS bridge
2002NotAuthorizedNotifications or Live Activities disabled
2003NotFoundNo running activity with that id
2004InvalidContentValidation failed (blank title, progress bounds, timer bounds, past dismissal)
2005TooManyActivitiesPlatform limit on concurrent activities
2006PayloadTooLargeEncoded request over 3 KB
2007AlreadyActivestart with an id that is already running
2008PlatformErrorAnything else the platform reported

getOrNull() and errorOrNull() are available on any result.