Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open iOS app when Push Notification custom button clicked? [duplicate]

I added some button into the iOS Push notification, e.g., I customized the Push Notification Banner/Alerts with some custom buttons, which I'd like to open the app.

Currently when I click the Banner/"Open" button of Alert dialog, the app runs successfully.

I want to add opening app event programmatically.

PS. It's about the interactive Push Notification. And on my research there isn't answer relevant to this question.

like image 971
Hiroto Avatar asked Jun 08 '15 12:06

Hiroto


People also ask

Why are my notifications popping up twice?

Android devices with 2 copies of the app installed on the device can also receive duplicate notifications. This could happen if you have a production and staging / dev app installed at the same time with different Android package names.

Do push notifications work when app is closed iOS?

Apple does not offer a way to handle a notification that arrives when your app is closed (i.e. when the user has fully quit the application or the OS had decided to kill it while it is in the background). If this happens, the only way to handle the notification is to wait until it is opened by the user.

Can push notifications be personalized?

To add an extra layer of personalization to an iOS or Android push campaign message, you can use geo-location based push notifications. There are two ways brands can send push notifications based on a user's location: Location-based notifications: App users receive these pushes based on data collected on the backend.

How do I open a push notification?

Turn on notifications for Android devicesTap More on the bottom navigation bar and select Settings. Tap Turn on notifications. Tap Notifications. Tap Show notifications.


1 Answers

Correction as Sudhan points out:

The UIUserNotificationAction objects that you are going to add to your UIUserNotificationCategory have a method activationMode, it can take constant UIUserNotificationActivationModeForeground

yourNotifificationAction.activationMode=UIUserNotificationActivationModeForeground

When the user presses the action button, app will launch in foreground and call this method on the appDelegate:

-(void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler
like image 175
Ishaan Sejwal Avatar answered Sep 23 '22 01:09

Ishaan Sejwal