session.openApplication() -- how to pass data from the extension to the application?

Hello,

I apologize if the answer is obvious but I'm having a hard time figuring this one out.

Let's say the user taps an "Edit" button in my LockedCameraCaptureSession. The extension calls:

activity.userInfo = ["ActivityKey": "ID"]
try await session.openApplication(for: activity)

Can I retrieve, in my application, the data stored in activity.userInfo (lets say, a flag "open editor"), or is data passing exclusively handled via appContext of CameraCaptureIntent?

Thank you!

Hi edee1337,

You can get the data in the activity by handling the UserActivity on any receiving end in your app. The User Activity for opening the app from the capture extension will be using the static NSUserActivityTypeLockedCameraCapture activityType.

You can do this in SwiftUI via onContinueUserActivity, or via AppDelegate callbacks - try implementing the didUpdate userActivity function.

session.openApplication() -- how to pass data from the extension to the application?
 
 
Q