I try action in my Notification click a button from "builder", but I can't.
I read documentation oficial :
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
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_prev, "Previous", prevPendingIntent) // #0 HERE A BUTTON
.addAction(R.drawable.ic_pause, "Pause", pausePendingIntent) // #1 HERE A BUTTON
.addAction(R.drawable.ic_next, "Next", nextPendingIntent) // #2 HERE A BUTTON
// Apply the media style template
.setStyle(new Notification.MediaStyle()
.setShowActionsInCompactView(1 /* #1: pause button */)
.setMediaSession(mMediaSession.getSessionToken())
.setContentTitle("Wonderful music")
.setContentText("My Awesome Band")
.setLargeIcon(albumArtBitmap)
.build();
I see this post :
Android, get Notifications Responses
And someone say :
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
Notification n = sbn.getNotification();
for(Action action : n.actions){
String title = action.title.toString;
...
}
}
But I can't use because I not extends of "NotificationListenerService" I extends of IntentService
How I can click Buttons and after occurs a event ?
Any can know differences about NotificationListenerService and IntentService ?
I hope explain correctly