I am doing Push notification message in android devices and follows GCM documentation for my reference and I have scenario that in the notification itself I have to show buttons and user clicked it will trigger the respective actions.
From the GCM documentation, in the notification payload we can add click_action to trigger the action when user touched notification...
How to show buttons (Like Accept/Reject ) in the notification message?
You can use
.addAction
inNotification.Builder
.
Notification notification = new Notification.Builder(context)
// Show controls on lock screen even when user hides sensitive content.
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setSmallIcon(R.drawable.ic_stat_player)
// Add media control buttons that invoke intents in your media service
.addAction(R.drawable.ic_accept, "Accept", prevPendingIntent) // #0
.addAction(R.drawable.ic_reject, "Reject", pausePendingIntent) // #1
// Apply the media style template
EDIT 1
Refer this link.