audio_manager icon indicating copy to clipboard operation
audio_manager copied to clipboard

Notifications not showing up on locked devices for newer version android

Open roeku opened this issue 3 years ago • 4 comments

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.

roeku avatar Apr 11 '21 19:04 roeku

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.

roeku avatar Apr 15 '21 13:04 roeku

have you open the app settings notification?

jeromexiong avatar Oct 05 '21 11:10 jeromexiong

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

rares45 avatar Oct 11 '21 17:10 rares45

@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

asifwedig2021 avatar Jan 25 '22 14:01 asifwedig2021