Получение нежелательной маржи/границы во всех пользовательских уведомлениях только в Android 14Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Получение нежелательной маржи/границы во всех пользовательских уведомлениях только в Android 14

Сообщение Anonymous »

Следующий код работает в API = android.os.Build.VERSION_CODES.S) {
pendingIntent = PendingIntent.getActivity
(getApplicationContext(),0,intent, PendingIntent.FLAG_MUTABLE);
}
else
{
pendingIntent = PendingIntent.getActivity(getApplicationContext(),0,intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
.
.
.
String channelId = getString(R.string.default_notification_channel_id);

NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this, channelId)
.setSmallIcon(iconId)
.setPriority(NotificationManager.IMPORTANCE_HIGH)
.setDefaults(Notification.DEFAULT_LIGHTS )
.setSound(null)
.setVibrate(new long[]{0, 500, 1000, 500, 200, 400, 100, 400, 600})
.setContentIntent(pendingIntent);

notificationBuilder.setColor(Color.parseColor("#FF9933"));
notificationBuilder.setChannelId(channelId);
notificationBuilder.setAutoCancel(false);

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
.
.
.

notificationBuilder.setCustomBigContentView(contentView);
notificationBuilder.setCustomHeadsUpContentView(contentView);

NotificationUpdater.turnOnForeground(this,notifId,notificationManager, notificationBuilder.build());
}

else
{
notificationBuilder.setContent(contentView);
notificationBuilder.setOngoing(true);
NotificationUpdater.turnOnForeground(this,notifId,notificationManager, notificationBuilder.build());
}
}
[/code]
my_notification_layout.xml Приведенный выше код работает в API

Подробнее здесь: https://stackoverflow.com/questions/793 ... android-14
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»