Search code examples
androidwidgetlockingscreenandroid-4.2-jelly-bean

Android Lock Screen Controls in <= 4.1.2


I know Jelly Bean 4.2 added the ability to create lock screen widgets, but I also noticed that certain apps (such as Spotify) have added lock screen play/pause/stop/etc controls even for my 4.1.2 phone. I can't for the life of me figure out how they did it, though. How can I do something like this in my apps?

Thanks!


Solution

  • http://developer.android.com/about/versions/android-4.0.html

    The new RemoteControlClient allows media players to enable playback controls from remote control clients such as the device lock screen. Media players can also expose information about the media currently playing for display on the remote control, such as track information and album art.

    and a few more paragraphs on the subject.

    You register a RemoteControlClient via registerRemoteControlClient() on AudioManager.