Планшет Nexus 7 не показывает действия с уведомлениями

Я пытаюсь показать действия с уведомлениями на Nexus 7 с Android 6.0.1, но это не отображается. Это из-за ОС? Я тестировал S6 Edge с Android 7.0, и он выглядит идеально.

NotificationCompat.Builder(this, resources.getString(R.string.default_notification_channel_id))
            .setSmallIcon(R.mipmap.ic_launcher_round)
            .setContentIntent(pIntent)
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .addAction(NotificationCompat.Action(R.mipmap.ic_launcher, resources.getString(R.string.confirm_action_notification), yesPendingIntent))
            .addAction(NotificationCompat.Action(R.mipmap.ic_launcher, resources.getString(R.string.deny_action_notification), noPendingIntent))
            .setPriority(PRIORITY_MAX)
            .setDefaults(Notification.DEFAULT_VIBRATE)
            .setCustomHeadsUpContentView(headsUpView)
            .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
            .setCustomContentView(collapsedView)
            .setCustomBigContentView(expandedView)
            .setStyle(NotificationCompat.DecoratedCustomViewStyle())
            .setPublicVersion(privateNotification)
            .build()

person Francisco Pereira    schedule 09.03.2018    source источник


Ответы (1)


Не могли бы вы попробовать следующий код:

Notification n = new Notification.Builder(context)
            .setContentTitle(violationHeader)
            .setContentText(message)
            .setSmallIcon(R.drawable.login_logo)
            .setContentIntent(pIntent)
            .setAutoCancel(true)
            .setSound(uri)
            .setVibrate(new long[]{10, 40, 100, 200, 10})
            .build();
    NotificationManager notificationManager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(notificationId, n);
person Manikandan K    schedule 09.03.2018
comment
Спасибо, но это не решает проблему. Ваше решение даже не добавляет действий. - person Francisco Pereira; 20.03.2018
comment
Проверьте ссылку: stackoverflow.com/questions/35647821/ - person Manikandan K; 20.03.2018
comment
Спасибо, но это не решение, потому что, к сожалению, Nexus 7 работает под управлением Marshmallow. Я не могу использовать API-уведомление и действие с уведомлением. - person Francisco Pereira; 20.03.2018