setShowBadge = false

This commit is contained in:
tzugen 2021-04-21 17:40:51 +02:00
parent e4bf431cfe
commit 88f6bdb3a9
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
1 changed files with 13 additions and 8 deletions

View File

@ -174,14 +174,7 @@ public class MediaPlayerService extends Service
};
// Create Notification Channel
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//The suggested importance of a startForeground service notification is IMPORTANCE_LOW
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, NOTIFICATION_CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW);
channel.setLightColor(android.R.color.holo_blue_dark);
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.createNotificationChannel(channel);
}
createNotificationChannel();
// Update notification early. It is better to show an empty one temporarily than waiting too long and letting Android kill the app
updateNotification(IDLE, null);
@ -644,6 +637,18 @@ public class MediaPlayerService extends Service
mediaSession.setPlaybackState(playbackState.build());
}
private void createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//The suggested importance of a startForeground service notification is IMPORTANCE_LOW
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, NOTIFICATION_CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW);
channel.setLightColor(android.R.color.holo_blue_dark);
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
channel.setShowBadge(false);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.createNotificationChannel(channel);
}
}
public void updateNotification(PlayerState playerState, DownloadFile currentPlaying)
{
if (Util.isNotificationEnabled(this)) {