I realize the music application may or may not be the same depending on the device, but I’m writing this application for my own device.
Am I correct in thinking I will need to create a service with my widget, then somehow bind this service to com.android.music.MediaPlaybackService?
I’m not finding much useful documentation on this, but looking in the market, there are numerous widgets that do this same thing. I’ve seen a few StackOverflow answers saying this is just not possible, yet at the same time, I’ve installed several widgets that do precisely this.
Has anyone done something similar that can point me in the right direction?
As of at least Android 2.2.2 this method does work.
I created a service for my widget. The onCreate of this service binds to com.android.music.IMediaPlaybackService.
The onStart of this service checks for a “command” flag and accordingly runs the bound service’s appropriate method through a private ServiceConnection, then the key was clearing the connection after every command, for example: