Based on user action I want to set another list as the primary list for MusicService
How I tried to achieve this by:
Made a static list of SongDataModel [That's my POJO/Parse Object (Subclass), using ParseSDK]
JsonSource class take this list as Input, then doing the conversion to respective model
Added a MediaSessionReceiver to the MediaSessionConnector in the service class and Send custom action using MediaControllerCompat.TransportControls but the MediaSessionReceiver never called
So, I have sent command to service class using MusicServiceConnection.sendCommand() and in the service class received command on MediaSessionConnector.PlaybackPreparer.onCommand()
After getting the command, I'm trying to set a different list of SongDataModel by updating JsonSource & it's correspondent but wasn't able to get what I wanted to achieve.
Another approach I tried:
Check if the static song source is the same or not in MusicService class
If condition matched, stop the Music Service and clear the instance of MusicServiceConnection
Then create new instance of MusicServiceConnection and setup everything again, but it throws exception java.lang.IllegalStateException: getRoot() called while not connected (state=CONNECT_STATE_CONNECTING) which is totally valid.
My Scenario:
MusicService
MusicService
How I tried to achieve this by:
SongDataModel
[That's my POJO/Parse Object (Subclass), using ParseSDK]JsonSource
class take this list as Input, then doing the conversion to respective modelMediaSessionReceiver
to theMediaSessionConnector
in the service class and Send custom action usingMediaControllerCompat.TransportControls
but theMediaSessionReceiver
never calledMusicServiceConnection.sendCommand()
and in the service class received command onMediaSessionConnector.PlaybackPreparer.onCommand()
SongDataModel
by updatingJsonSource
& it's correspondent but wasn't able to get what I wanted to achieve.Another approach I tried:
MusicService
classMusic Service
and clear the instance ofMusicServiceConnection
MusicServiceConnection
and setup everything again, but it throws exceptionjava.lang.IllegalStateException: getRoot() called while not connected (state=CONNECT_STATE_CONNECTING)
which is totally valid.