audio_manager
audio_manager copied to clipboard
Notifications not showing up on locked devices for newer version android
I've tested this on an OnePlus and it functions fine. But running the same code on Xiaomi devices for some reason doesn't show the notification when the phone is locked. It does show it when you pull the notifications drawer down when the phone is open, but not on the locked screen. I was thinking it might have to do with the NotificationManager.IMPORTANCE_LOW
but tried setting that to different levels but that didn't help. Any advice on how to fix would be much appreciated.
So I've investigated this further and noticed it does have to do with the settings on newer devices, we need to give explicit permission for the notification to appear on locked screens. Without the permissions, it won't appear. I tried updating the code to make it so that we wouldn't need to prompt the user but I couldn't find a way to do it. I did see that spotify does have a way of doing it without the permissions so it should be possible. I couldn't figure it out though.
have you open the app settings notification?
This is because after Android 11 you need to use Media Controls instead of regular notifications. https://developer.android.com/guide/topics/media/media-controls
@roeku @jeromexiong @rares45 have you found any solution for the same Android 11 Quick setting issue as well as locked screen issue. if any one found any solution please share it. Thanks