Reputation: 1161
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
Upvotes: 17
Views: 21224
Reputation: 10444
You can also add custom buttons or layouts with onClickEvents to your notification compat (e.g. events which do not open the app ;)):
builder.setContent(remoteView);
remoteView.setOnClickPendingIntent(R.id.button, pendingIntent);
Happy coding
Upvotes: 2
Reputation: 1161
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/
Upvotes: 25
Reputation: 6164
From what I understand of what your asking, you need to run a AlarmManager that launches background services at specified times to create notifications, and then you need to specify the intent for the notification to do what you want it to do.
If you are getting Push notifications, then forget the AlarmManager and just launch the action you want to do from the intent in the notification.
For more specific answer we need a more specific question.
Upvotes: 0