I've found out that the MediaStyle setStyle is not working when I'm using
NotificationCompat.builder(this)
to make a notification.
I mean, When using this on NotificationCompat.Builder(this)
:
.setStyle(new Notification.MediaStyle()
.setMediaSession(mySession))
It saying it wants to get NotificationCompat.style
instead of Notification.MediaStyle
.
Can you help me solve that problem? Is there any replacement for the NotificationCompat?
Thanks.
For AndroidX in 2020 you can use following code -
builder.setStyle(new androidx.media.app.NotificationCompat.MediaStyle());
don't forget to add the androidx.media dependency in build.gradle(Module:app)
implementation "androidx.media:media:1.2.0"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With