Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android notifications actions without opening the app

I want to implement a notification action in JB. But it shouldn't open the app. The behaviour is similar to the Gmail apps delete notification action. How can I do this?

Thanks in advance, Shashika

like image 563
Shashika Avatar asked May 06 '13 04:05

Shashika


People also ask

Does an app need to be open for push notifications?

Today, both mobile push notifications are also supported on Android devices. Messages are sent from a mobile app to a user's phone screen. Before viewing these alerts from companies, a user must have downloaded their mobile app and opted into notifications.

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.

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() .


1 Answers

After some research I managed to achieve this using a broadcast receiver. I posted the example code here. http://shashikawlp.wordpress.com/2013/05/08/android-jelly-bean-notifications-with-actions/

like image 99
Shashika Avatar answered Nov 15 '22 20:11

Shashika