A few users have been asking me Android lock screen widgets for my app - I believe they want a widget that stays on their lock screens and allows them to interact with the app.
I haven't been able to find any official documentation for this - the only thing I found was apps that will take home screen widgets and put them on the lock screen for you.
Any clues on where I learn more about building true lock-screen widgets?
Lock screen interaction is difficult. Android allows basic operations with two window flags (FLAG_SHOW_WHEN_LOCKED and FLAG_DISMISS_KEYGUARD). FLAG_SHOW_WHEN_LOCKED works pretty consistently in that it will show on top of the lock screen even when security is enabled (the security isn't bypassed, you can't switch to another non-FLAG_SHOW_WHEN_LOCKED window).
If you're just doing something temporary, like while music is playing or similar, you'll probably mostly be okay. If you're trying to create a custom lock screen then there's a lot of unusual interactions on all the different android platforms. ("Help! I can't turn off my alarm without rebooting my HTC phone").
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html
Official Lock screen widget document is here
I had to implement a lock screen widget for my project. In the process, I accumulated a couple of resources.
AppWidget
class to do this.AppWidgetHost
class from the Android API to make your lock screen a host for the widgets. I don't know how to do this part, but there are some existing implementations like mylockandroid (links below).Resources
http://code.google.com/p/mylockforandroid/ (NB This code is for older versions of Android. Android 4.2 and up has built in lockscreen widget support)
http://mylockandroid.blogspot.com/2010/03/widget-lockscreen-beta-11-r2.html