OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
496 stars 263 forks source link

Handle tap on push notification #1361

Closed igorsquadra closed 9 months ago

igorsquadra commented 9 months ago

How can we help?

I need to handle the tap on push notification with launch url. I migrate from 2.5.2 to 5.0.5 and my old code was:

OneSignal.initWithLaunchOptions(launchOptions, appId: "appId", handleNotificationReceived: { (notification) in self.open((notification?.payload)!) }, handleNotificationAction: nil, settings: [kOSSettingsKeyInFocusDisplayOption: "None", kOSSettingsKeyInAppLaunchURL: false])

Can you please help me with this migration? I wasn't able to find something interesting in the documentation

Code of Conduct

emawby commented 9 months ago

@igorsquadra Hello you will want to use the clickListener method in the Notification namespace. This listener will be called whenever a notification is tapped including when it is used to launch the app.

emawby commented 9 months ago

Closing for now. Feel free to tag me to reopen if you need additional help.