Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide notification action button at run-time

I have registered for push and local notifications with two action buttons: action1 and action2. Upon receiving the notification, I can see both and can also take action depending on the action id. However, one of my use cases requires me to hide one or both the action buttons before I schedule local notification. Can I do that at run-time?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

In this method I am registering for notifications with 2 action buttons.

I see that depending on context we can define variable number of action buttons. However, context is predefined and not user defined.

like image 365
Astha Gupta Avatar asked Nov 29 '16 05:11

Astha Gupta


People also ask

How do you handle opening activity using notifications?

Build and issue the notification: Create an Intent that starts the Activity . Set the Activity to start in a new, empty task by calling setFlags() with the flags FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TASK . Create a PendingIntent by calling getActivity() .

How do you add action buttons to push notifications?

All you need to do is go to "New Message", select "Options", and add custom action buttons in the dashboard interface specific to which platform (mobile vs web) you are sending the notifications to. Each button will have its own identifier, call-to-action text, and if supported, an icon.

How do I make my Android notifications clickable?

1 Answer. Show activity on this post. setContentIntent(PROVIDE_YOUR_PENDING_INTENT); You will need to provide a pending intent to where you want to redirect the user when he click on the notification.


1 Answers

Register user notification with multiple categories as you required like category1 with two actions, category2 with no action, category3 with only one action.

When creation of local notification, Use a defined category as you required. like this notificationName.category = @"Category_identifier";

like image 161
Balaji Avatar answered Oct 28 '22 21:10

Balaji