Android MVVM - Where to bind to a Mediaplayer bound service?

Viewed 181

I have a permanent bound service with a Mediaplayer and a MediaSession. I am refactoring my app to an MVVM architecture with HILT .

I'd like to know where I should bind to the service and where to save the IBinder and the media controler :

  • The application ?
  • the UI fragments or activity?
  • the shared viewmodel ?
  • the repository ?
  • somewhere else ?

The difficulty of using the repository is that it is injected in the viewmodel from a HILT Module.

It would be much appreciated if you could provide some guidelines.

0 Answers
Related