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
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.
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.
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() .
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With