Using iOS 17 and React Native, I managed to call a RN function from iOS Live Activities button widget using LiveActivityIntent and NotificationCenter. However, in addition to calling a function into RN, I also would like to open the same React Native app (put it in foreground) (mimic the default Live Activity tap behavior). Can someone please tell me how to do it? If I click the button, it executes the function only, but does not open the app...
@available(iOS 17.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) struct SuperCharge: LiveActivityIntent {
static var title: LocalizedStringResource = "Emoji Ranger SuperCharger"
static var description = IntentDescription("All heroes get instant 100% health.")
func perform() async throws -> some IntentResult {
print("calling function from Swift!!!!!")
NotificationCenter.default.post( name: Notification.Name("InvokeEvent"),
object: nil,
userInfo: ["message": "Hello from Widget"]
)
return .result()
}
}
I reviewed the apple docs below, but could not find an answer or example: https://developer.apple.com/documentation/widgetkit/linking-to-specific-app-scenes-from-your-widget-or-live-activity