Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After setLockscreenVisibility(Notification.VISIBILITY_SECRET) the notification channel is still appearing on lockscreen

After set a notification channel to not show notifications at lockscreen, it still is showing the notifications on lockscreen.

notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
notificationManager.createNotificationChannel(notificationChannel);

But after the creation of the channel I can debug it and see that the notification channel does not have the lockScreenVisibility set to VISIBILITY_SECRET (-1), it still has the default value, that is -1000.

notificationChannel.getLockscreenVisibility()

Does anyone knows how to set the lockscreen visibility to not show on lockscreen? Or have any idea why it is not being updated?

One more information is that I already have created the channel previously. But I have deleted and recreated the channel with the VISIBILITY_SECRET.

like image 582
JonasOliveira Avatar asked Dec 19 '22 02:12

JonasOliveira


1 Answers

When you delete and recreate a channel, all of the previous settings are restored. You must create a brand new channel (with a different channel ID) or completely uninstall/reinstall the app if you want to change anything other than the channel's name or description.

like image 154
ianhanniballake Avatar answered Jan 05 '23 15:01

ianhanniballake