You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to implement androidx.media3.session.MediaButtonReceiver.shouldStartForegroundService, I need to inject something. I can either use @androidentrypoint or use @entrypoint. The former doesn't work because the dagger generated code overrides onReceive and androidx.media3.session.MediaButtonReceiver implementation of onReceive is final. The latter doesn't because I don't have context needed to use the @entrypoint.
Proposed solution
Where the androidx.media3.session.MediaButtonReceiver calls shouldStartForegroundService, it has a context. In fact it uses when it calls ContextCompat.startForegroundService, in order to correctly implement shouldStartForegroundService I need same information.
Alternatives considered
Copying the code from androidx.media3.session.MediaButtonReceiver to implement my own (not a great option).
Note, this is with 1.5.0-rc01
The text was updated successfully, but these errors were encountered:
Yup, that is a valid request. Thanks for the suggestion. We will pass the context, we get in onReceive to shouldStartForegroundService. We will update this issue when this lands in the main branch.
Yup, that is a valid request. Thanks for the suggestion. We will pass the context, we get in onReceive to shouldStartForegroundService. We will update this issue when this lands in the main branch.
[REQUIRED] Use case description
In order to implement androidx.media3.session.MediaButtonReceiver.shouldStartForegroundService, I need to inject something. I can either use @androidentrypoint or use @entrypoint. The former doesn't work because the dagger generated code overrides onReceive and androidx.media3.session.MediaButtonReceiver implementation of onReceive is final. The latter doesn't because I don't have context needed to use the @entrypoint.
Proposed solution
Where the androidx.media3.session.MediaButtonReceiver calls shouldStartForegroundService, it has a context. In fact it uses when it calls ContextCompat.startForegroundService, in order to correctly implement shouldStartForegroundService I need same information.
Alternatives considered
Copying the code from androidx.media3.session.MediaButtonReceiver to implement my own (not a great option).
Note, this is with 1.5.0-rc01
The text was updated successfully, but these errors were encountered: