Googling found several examples, doing everything as it is written, but for some reason the buttons are not displayed ...

Here is the code

public static void sendNotification(Bundle extras, Context context) { NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder mBuilder = getStandardPriorNotification(extras, context); mNotificationManager.notify((int) System.currentTimeMillis(), mBuilder.build()); } private static NotificationCompat.Builder getStandardPriorNotification(Bundle extras, Context context) { PendingIntent contentIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), new Intent(context, UserDataScreen.class), 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.logo) .setLargeIcon(icon) .setContentTitle(title) .setStyle(new NotificationCompat.BigTextStyle().bigText(body)) .setContentText(body) .setContentIntent(contentIntent) .setAutoCancel(true) .addAction(R.drawable.logo, "Last", getee(context)) .addAction(R.drawable.logo, "Last", getee(context)); return mBuilder; } private static PendingIntent getee(Context context) { Intent maybeReceive = new Intent(); maybeReceive.setAction("CUSTOM_INTENT"); Bundle maybeBundle = new Bundle(); maybeBundle.putInt("userAnswer", 3);//This is the value I want to pass maybeReceive.putExtras(maybeBundle); PendingIntent pendingIntentMaybe = PendingIntent.getBroadcast(context, 12345, maybeReceive, PendingIntent.FLAG_UPDATE_CURRENT); return pendingIntentMaybe; } 

I expect to see 2 buttons under push notification , but they are not shown ...

What am I doing wrong?

  • This is a bug related to the fact that the buttons are not displayed if the phone is connected via usb to the computer. Try to get the notification, with the cord pulled out - Android Android
  • Whatever ... Nothing has changed. But I connected another phone and it all worked ... It's very strange that it works on one, not on the other ... - Aleksey Timoshchenko

0