Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot override DefaultMediaNotificationProvider.handleCustomCommand #103

Closed
kevinguitar opened this issue Jul 1, 2022 · 4 comments
Closed

Comments

@kevinguitar
Copy link

Hi media team 👋

I was trying to extend your DefaultMediaNotificationProvider and use our internal BitmapLoader implementation, but turns out the handleCustomCommand function is final and can't be overridden.

I'm wondering is that intended for some reason? I would like to use your notification provider implementation which contains nice bitmap/ notification builder handling, but I need to provide some custom actions.

Looking forward to your answers, thanks!

media3 Version: 1.0.0-beta01

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Jul 1, 2022

You can receive the custom command on MediaSession.Callback.onCustomCommand. Why do you want to receive them on the provider? If your app is running with compileApiLevel 32 and on Android 13, the custom command is sent from the SystemUI notification directly to the session MediaSession.Callback.onCustomCommand. So you would have to handle it for Android 13 on the session and for API levels before Android 13 on the DefaultMediaNotificationProvider.

So I think you want to override MediaSession.Callback.onCustomCommand instead so you only have to do this once.

See #38 also.

@kevinguitar
Copy link
Author

@marcbaechinger Thanks for the quick response! And yes, that's definitely what I need, closing the issue, thanks!

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Jul 1, 2022

Great! Thanks for confirming!

We should document this better. I added the documentation candidate label and re-open this issue for tracking this.

@marcbaechinger marcbaechinger reopened this Jul 1, 2022
@kevinguitar
Copy link
Author

Yeah, I guess I was confused by the methods' documentation in MediaNotification.ActionFactory 😅

marcbaechinger added a commit that referenced this issue Jul 4, 2022
Issue: #103
#minor-release
PiperOrigin-RevId: 458465479
rohitjoins pushed a commit that referenced this issue Jul 15, 2022
Issue: #103
#minor-release
PiperOrigin-RevId: 458465479
(cherry picked from commit 2c08068)
@androidx androidx locked and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants