iOS Development

swift – Name a operate from iOS Interactive Reside Exercise into RN AND additionally open the React Native App

Utilizing iOS 17 and React Native, I managed to name a RN operate from iOS Reside Actions button widget utilizing LiveActivityIntent and NotificationCenter. Nonetheless, along with calling a operate into RN, I additionally want to open the identical React Native app (put it in foreground) (mimic the default Reside Exercise faucet conduct). Can somebody please inform me find out how to do it :)? If I click on the button, it execute the operate solely, however doesn’t open the app…

@obtainable(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 prompt 100% well being.")

func carry out() async throws -> some IntentResult {
    print("calling operate from Swift!!!!!")

  NotificationCenter.default.put up( title: Notification.Identify("InvokeEvent"),
                                   object: nil,
                                   userInfo: ["message": "Hello from Widget"]
  )
    return .end result()
}

}

I reviewed the apple docs under, however couldn’t discover a solution or instance: https://developer.apple.com/documentation/widgetkit/linking-to-specific-app-scenes-from-your-widget-or-live-activity

Credit: www.ismmailgsm.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button