title: automatically put android widget on lock screen under certain conditions
body: <p>I am making an mp3 player for myself and have created a homescreen widget for it.  I can add it to my lock screen by virtue of having included:</p>
  
  <pre><code>android:widgetCategory="keyguard|home_screen"
  </code></pre>
  
  <p>in my appwidget provider.  This doesn't quite meet my requirements for two reasons.  1) it's ALWAYS there whether I want it or not (only want it when music is playing) and 2) it doesn't seem to work very well, I have to unlock the widget to enable it and even then the buttons work sporadically.</p>
  
  <p>The phone I have (HTC One) came stock with an mp3 player that puts itself on my lock screen automatically when music is playing and removes itself when it's not.  Unfortunately, this is the only thing I like about this mp3 player thus my reasoning for writing my own.  I therefore know that this can be done, I just have run the well dry in terms of searching for how to do it.  I'm on android 4.3 with my HTC One and I really only care about this application working for myself (I have no intention of putting it on the store or anything).</p>
  
  <p>Given that information, can someone provide some assistance/direction of how I can accomplish what I want?  To reiterate, when music is playing I want my widget to appear on the lock screen and have the buttons available w/o needing to swipe that screen at all (just like the stock player).  When music is stopped/paused, I want that widget removed from the lock screen (also just like the stock player).</p>
  
  <p>TIA</p>