Search code examples
androidandroid-widgetandroid-appwidgetandroid-4.2-jelly-beanlockscreen

How to dynamically add a lock-screen widget


Google Play Music app adds a special lock-screen widget dynamically when playing music (on Jelly Bean), and removes it after exit. This widget cannot be removed manually by dragging, and when I unlock my phone, it is always the top one besides other lock-screen widget.

How to implement this special dynamic lock-screen widget? I can only find documents about regular lock-screen widget, but not for this.


Solution

  • I was looking for the same thing and found out this is done by using the RemoteControlClient, check @CommonsWare answer here What is RemoteControlClient in Android 4.0?