Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show Notification data when "Hide sensitive information" is active

In Android, if a user has lock screen and has selected hide sensitive information option, the notification's description shows as "content-hidden" while the screen is locked. I understand that this is how the feature is designed but is there a way for the notification of my app to be displayed as normal notification in this case too?

My app is solely based on Notifications so I want to give user a change to always see the notifications, if he wishes. I tried searching for a way to always show notification text but couldn't find any.

like image 339
Rohan Kandwal Avatar asked Jan 05 '23 12:01

Rohan Kandwal


1 Answers

The Notifications guide on visibility notes that you can use setVisibility() with VISIBILITY_PUBLIC to always allow users to view your notification, even when they have "Hide sensitive information" enabled.

You can also use setPublicVersion() to build a separate notification that shows only non-sensitive information to specifically handle this case.

like image 84
ianhanniballake Avatar answered Jan 14 '23 07:01

ianhanniballake