@rsatarov

Как исправить серую иконку в шторке уведомлений?

При создании уведомления иконка приложения в статус баре отображается нормально.
Скрин 1
5cced9c5c0a09791502200.jpeg

Но если смотреть в шторке, то она окрашивается в серый.
Скрин 2
5cced9d1960ec397359101.jpeg
Код, создающий уведомление.
private void createNoteNotification(int noteId) {
    AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
    Intent intent = new Intent(this, AlarmReceiver.class);
    intent.putExtra("id", noteId);
    intent.putExtra("dateTime", notificationDateTime);
    intent.putExtra("title", titleField.getText().toString());
    intent.putExtra("text", noteTextField.getText().toString());
    PendingIntent alarmIntent = PendingIntent.getBroadcast(this, noteId, intent, 0);
    alarmManager.setExact(AlarmManager.RTC, notificationDateTime, alarmIntent);
}

public static class AlarmReceiver extends BroadcastReceiver {
    public AlarmReceiver() {
    }
    @Override
    public void onReceive(Context context, Intent intent) {
        int id = intent.getIntExtra("id", 0);
        long dateTime = intent.getLongExtra("dateTime", 0);
        String title = intent.getStringExtra("title");
        String text = intent.getStringExtra("text");

        Intent deleteIntent = new Intent(context, DeleteNoteService.class);
        deleteIntent.putExtra("id", id);
        deleteIntent.setAction(DeleteNoteService.ACTION_DELETE_NOTE);
        PendingIntent deletePendingIntent = PendingIntent.getService(context, id, deleteIntent, 0);

        NotificationCompat.Builder builder = new NotificationCompat.Builder(context, context.getString(R.string.notification_channel_id))
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentTitle(title)
                .setContentText(text)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(text))
                .setWhen(dateTime)
                .addAction(R.drawable.ic_delete_white_24dp, context.getString(R.string.delete), deletePendingIntent);

        ((NotificationManager) context.getSystemService(NOTIFICATION_SERVICE)).notify(id, builder.build());
    }
}
  • Вопрос задан
  • 306 просмотров
Решения вопроса 1
@rsatarov Автор вопроса
Вопрос решен созданием другой иконки через Asset Editor.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы