Reputation: 42
So I'm creating an app with MVVM, which is a Music Player, managed by Notification Bar. The only action I want to use Activity for is to start the player.
Right now all the logic is in the activity, and the app works perfectly fine this way. But I want to move the logic someplace else. When I relocate all the logic to a regular class, though, I can't access the Viewmodel. What would be the right way to separate player instantiation from its management? Fragment? Service? Something else?
Thanks in advance. Any ideas will be very appreciated.
Upvotes: 0
Views: 83
Reputation: 42
In the end it turns out that the best way to manage player and its inner state in a started bound service. It should be started so it won't stop when an activity goes down, and it should be bound in case you want to connect notification to activity.
Upvotes: 1