• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Unable to add action button to notification message

AKA001

Newbie
Feb 10, 2016
10
0
Hello All,

I have been trying to add an action button to the notification message, but it is not showing up. Also, any change i am making to customise the notification message is not taking effect for e.g.. set lights, big text etc:



Intent notificationIntent1 = new Intent( context, null );

PendingIntent contentIntent1 = PendingIntent.getActivity(context, 0, null, 0);;

///


NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder( context );

notificationBuilder.setSmallIcon(appIcon);

notificationBuilder.setTicker(tickerText);

notificationBuilder.setWhen(System.currentTimeMillis());

notificationBuilder.setContentTitle(contentTitle);

notificationBuilder.setContentText("testing");

notificationBuilder.setAutoCancel(true);

notificationBuilder.setContentIntent(contentIntent);



notificationBuilder.setStyle(new NotificationCompat.BigTextStyle());

notificationBuilder.addAction(new NotificationCompat.Action(R.drawable.icon, "futher",contentIntent1));

// notificationBuilder.addAction(R.drawable.icon,"test", PendingIntent.getActivity(context, 0,notificationIntent1, 0, null) );

Notification notification = notificationBuilder.build();



NotificationManager notificationManager = (NotificationManager) context.getSystemService( Context.NOTIFICATION_SERVICE );

notificationManager.notify( 0, notification );

Appreciate your assistance in advance
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones