Кнопка действия уведомления Android Nougat не отображается - PullRequest
0 голосов
/ 26 сентября 2018

Вот библиотека, используемая в файле build.gradle уровня приложения:

 implementation 'com.android.support:appcompat-v7:28.0.0'

Вот код уведомления:

 Intent snoozeIntent = new Intent(getApplicationContext(), MyBroadcastReceiver.class);
        snoozeIntent.setAction(MY_ACTION);
        snoozeIntent.putExtra("EXTRA_NOTIFICATION_ID", 0);
        PendingIntent snoozePendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, snoozeIntent, 0);

 NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext(),"Hello")
                .setPriority(Notification.PRIORITY_MAX)
                .setWhen(0)
                .setShowWhen(false)
                .setContentTitle("My Custom Notification")
                .setContentText("Hello Custom")
                .setSmallIcon(R.drawable.ic_battery_charging_full_white_24dp)
                .addAction(android.R.drawable.ic_input_add,"Action 1",snoozePendingIntent);

NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
        notificationManager.notify(1,notificationBuilder.build());
...