How to create no dismissible type Live Activities that appear at the bottom of the Lock Screen?

179 Views Asked by At

I have designed a live activity which is working fine. It starts and ends as expected but it feels like a notification instead of live activity like Uber or any other app like BookMyShow where live activity always appear at the bottom of the screen and the don't get swiped away while swiping right on my activity, it shows a trailing action to clear it. This is what I want: Desired Live Activity on Lock Screen

And currently this is what I have made:My Live Activity appearing more like a standard notification

As you can see, my live activity has space below it for the notifications and when there are other notifications, it appears like a notification above them just with a different UI but I want something like above where the live activity appears right above flashlight and camera button as soon as its started and no option to swipe away but instead it will end after a specific time automatically and will be removed from the Lock Screen.

This is how I'm starting the activity:

@MainActor func startActivity(imageString: String, title: String, subtitle: String) {
        let attributes = LiveActivityAttributes(name: "Test Activity")
        
        let state = LiveActivityAttributes.status(imageString: imageString, title: title, subtitle: subtitle)
        do {
            _ = try Activity<LiveActivityAttributes>.request(attributes: attributes, content: ActivityContent(state: state, staleDate: nil))
        } catch {
            print("LiveActivityManager: Error in LiveActivityManager: \(error.localizedDescription)")
        }
    }

I don't see any option to start an activity differently, it always start above other notifications with a clear trailing swipe action like notifications unlike Uber or BookMyShow Activity or the above activities in the screenshot.

0

There are 0 best solutions below