I have an issue with hiding the notification icon in the status bar from a service notification.
Here what I did: I set the notification priority to min, make them silents
NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"test");
builder.setSmallIcon(R.drawable.notif);
builder.setContentTitle(getString(R.string.app_name));
builder.setContentText(profile.mName);
builder.setContentIntent(pendingIntent);
builder.setNotificationSilent();
builder.setPriority(NotificationCompat.PRIORITY_MIN);
In the channel, I set the priority to min too but I still see the notification icon in the status bar
NotificationChannel channel = new NotificationChannel(id, getApplicationContext().getString(R.string.app_name), NotificationManager.IMPORTANCE_MIN);
channel.setSound(null, null);
channel.setImportance(NotificationManager.IMPORTANCE_MIN);
channel.enableVibration(false);
Alright, the thing I can understand that you first tried with priority or importance high with notification channel. According to documentation once notification channel created then it cannot be updated by changing code. If you want to apply new changes like priority or importance low like you did in code, then you need to clear app cache
or uninstall app
and then re-install again.This will apply new notification channel changes to your app.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.