|Windows Phone: tips for lock screen functionality
||[Dec. 3rd, 2013|10:35 pm]
Motivational Penguin was my first app that had any lock screen functionality, so I thought I'd write up a few tips I learned along the way.
- The official lock screen documentation is quite good - see also the lock screen design guidelines. Although I didn't strictly obey the "Keep any text or graphics within this area" boxes - it seems like there's nothing wrong with spreading out to the right of the box?
- Motivational Penguin updates the lock screen in the background (which is common), and I ran into some trouble with the background agent. This is why I wrote a post about debugging scheduled tasks recently - there are some helpful tips in there!
- You will need some way to let the user decide whether to have the app update your lock screen or not (my app does this via a ToggleSwitch, part of the Windows Phone Toolkit). Be careful that if the user does let your app update your lock screen that you also check the value of Windows.Phone.System.UserProfile.LockScreenManager.IsProvidedByCurrentApplication - if this is false then your app won't have permission to update the lock screen. In my app I check this every time I show the ToggleSwitch and if it is false, make sure the ToggleSwitch is false as well.
- A nice feature to add is to configure how often to update the lock screen. I took my list of choices from Memorylage, my favorite lock screen updater. (seriously, check it out, it's great and well worth it!) Memorylage allows updates Hourly, TwiceDaily, Daily, and EveryOtherDay. To implement this, you can store the last time you updated the lock screen in System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings, and if enough time hasn't passed, just exit early.
I hope these are helpful! Being able to update the lock screen in the background is really pretty cool :-)
See all my Windows Phone development posts.
I'm planning on writing more posts about Windows Phone development - what would you like to hear about? Reply here, on twitter at @gregstoll, or by email at email@example.com.