title: How to create "lockscreen-like" music playback controls
body: <p>I am trying to create widget that can control music playback. Basically the same as the widget that appears on lockscreen when music is playing. (Which as I read somewhere, is connected to the <a href="http://developer.android.com/reference/android/media/RemoteControlClient.html" rel="nofollow">Remote Control Client</a> - is that true?) My problem:
  I was able to create Media Buttons using the following code</p>
  
  <pre><code>Intent i = new Intent(Intent.ACTION_MEDIA_BUTTON);
      synchronized (this) {
          i.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_NEXT));
          sendOrderedBroadcast(i, null);
          i.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_NEXT));
          sendOrderedBroadcast(i, null);
  </code></pre>
  
  <p>First, I thought this was the solution used also in the lockscreen widget. But then I noticed that this solution works only with some music players, but certainly not with all that can be controlled by default lockscreen widget(f.e. DoubleTwist responds to lockscreen widget, but not to my Media Buttons). So I spent last few days digging in the Android sources, Logcat outputs and various forums, but I was not able to find any difference between intents called by my buttons and by buttons on the lockscreen widget.</p>
  
  <p>What exactly is lockscreen widget doing to control apps that are not listening to my Media Button intents? </p>
  
  <p>Or, can somebody at least help me to find the source code of this widget? I tried default music app, audio service, remote control client, widgets, but I can't find it anywhere.</p>