I am using the notification builder to notify the notification on the device. And all of this is working fine. I have implemented the pending intent. Whcih takes the user to the activity when ever user click the notificcation. Also when the user click on the notification the notification disappears as I wanted by setting the auto cancelable property to true.
Let me show you the way I am starting and notifying the notification
mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(DownloadService.this)
.setSmallIcon(R.drawable.download)
.setContentTitle("MyApps")
.setContentText("Downloading new tracks");
mBuilder.setAutoCancel(true);
Intent targetIntent = new Intent(DownloadService.this,TrackClass.class);
PendingIntent contentIntent = PendingIntent.getActivity(DownloadService.this, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(contentIntent);
mNotifyManager.notify(1, mBuilder.build());
So this all is working fine Also I am showing the progress and updating the progress in the notification .
What I want: this is why I posted the Question ,
"I want to add the button along with the notification, so that when user click on the button it should close the service. I have implemented the click action on the notification But I have no Idea How to add the button in it"
Please tell me How Can I achieve this?
Note: Please keep in mind I am making and updating the notification in the service.
I think Now I am quite clear about what I want and what is my question all about. So please tell me how can I add the button in this notification ?
Edited 1:
I want that If I implement the custom xml for the notification , then the other attributes like showing my app name on notification and a little ticker message on notification , would they still be able to show by the side of notification , or I have to show them explicitly ?