Lock screen overview (Windows Store apps)
This topic discusses the concepts and terminology surrounding an app's presence on the lock screen. The lock screen is the screen shown when you lock your computer, as well as when you reboot the device or wake it from a sleep state. It is a user-customizable surface that both conveys information and protects the computer against unauthorized use.
The Windows 8 lock screen serves three basic purposes:
- Prevents accidental sign-in attempts on touch devices
- Provides a personalized surface for the user
- Displays lightweight information to the user:
- Date and time
- Network and battery status
- Notifications from a limited set of apps
The following image shows the lock screen.
The lock screen contains a mix of Windows, user, and app content.
- Background image: The image displayed as the lock screen background can be customized by the user through the Personalization page of PC Settings. A light transparent wash is applied to the selected image to increase the visibility of lock screen text and icons.
- Date and time: The date and time are always shown and cannot be customized.
- Network status and battery life icons: The network icon is always shown, but of course the battery icon is only shown for devices that have a battery.
An app can reflect three different types of information to the lock screen:
- The app tile's current badge
- The text from the app tile's most recent tile notification
- Toast notifications
Up to seven apps can have a lock screen presence at once. All seven apps can show badges and toast, but only one of those apps is allowed to show the text of its latest tile notification.
As long as your app has been granted a tile or badge slot on the lock screen and is declared Toast Capable in the app's package.appxmanifest file, any toast notifications sent by your app will appear on the lock screen when the device is locked. Note that unlike the detailed tile, toast includes both image (if present) and text—toast displayed on the lock screen is identical to toast displayed elsewhere. However, all toasts displayed on the lock screen are shown for the length of a long-duration toast.
The lock screen is designed to show information that a user can take in with a glance. Users should not have to dwell on this screen to receive information. The best app candidates to be placed on the lock screen can convey understandable, context-free, summary information through only a badge and a logo icon. For example, a mail app that shows a badge with a count of unread messages would work well on the lock screen. An example badge (3) and logo icon (star) is shown in the image above.
When a user places an app on their lock screen, they're indicating that the information which the app provides is important to them, so the app should convey real-time information through the lock screen. For instance, a communication app informs the user when they've received a message or when they're receiving a call. The app's lock screen presence should always reflect real-time information so the user can have confidence that they're seeing the latest status when they glance at their screen for updates.
Lock screen content simply mirrors the content of the app's Start screen tile or badge and does not require any additional API calls. However, because on the lock screen the badge sits next to a logo image rather than on a tile and only the text portion of a tile update is shown, some context is lost, and this can be a factor in whether your app is a good candidate to be added to the lock screen.
Careful consideration should also be taken when choosing to show a detailed status (tile notification content) on the lock screen. Be aware that images in the tile update are not displayed on the lock screen. Therefore, a social app that identifies the source of an update only through a contact's picture is not a good candidate to be shown on the lock screen because that context would be lost. However, an app with a text-driven calendar tile would work well.
For more detailed information, see the lock screen section of Guidelines and checklist for tiles and badges.
Note When a device is locked, your app does not need to declare lock screen capabilities to play sound or to show information about what is currently playing in the volume flyout. This applies particularly to music players. Unless your app otherwise meets the recommendations above and follows the lock screen guidelines, your app should not declare lock screen capabilities merely for sound playback because it will pointlessly occupy one of the limited lock screen slots, blocking an app which actually needs that slot to function properly.
For your app to become a lock screen candidate, you must first declare its lock screen capabilities and elements in your app's package.appxmanifest file. In that file's XML structure, this information is added to the VisualElements element, unless stated otherwise. However, in what follows, we assume that you are using the Microsoft Visual Studio manifest editor.
Note These steps are detailed in How to show notifications on the lock screen.
If you use the Visual Studio manifest editor, choose the appropriate Lock screen notifications option in the Application tab. The choices are:
- Badge: Your app can show only a badge on the lock screen.
- Badge and Tile Text: Your app can show both a badge and a detailed status on the lock screen.
Both options provide that toast notifications for your app will appear on the lock screen if toast is enabled for this user.
When your app's badge is shown on the lock screen, it appears next to an icon for your app. This icon is specific to your badge, and should not be confused with the logo, small logo, or wide logo images used by the app on the tile or in search results. An example is shown here: the star is the badge icon, the number 3 is the numeric badge itself.
This icon must meet these requirements:
- Size: 24 x 24 pixels
- Type: .png
- Color: monochrome white
- Transparency: any
If a tile is not currently displaying a badge, nothing is shown in the badge's slot on the lock screen.
When the lock screen displays text from a tile update, it does so only in a wide tile. Therefore, if you declared the Badge and Tile Text option, you must provide a wide logo for your app's tile or your manifest will be invalid and your app will not build. The wide logo is declared in your manifest and in the Visual Studio manifest editor as part of the default tile. For more information, see Quickstart: Creating a default tile using the Microsoft Visual Studio manifest editor.
If the tile notification currently shown on the lock screen is removed, nothing is shown in its place until a new tile notification arrives.
An app with a lock screen presence must declare one of the following types of background tasks:
- Control Channel
- Push Notification
Conversely, the user must place an app on the lock screen before the app can run one of those types of background tasks.
In Visual Studio, this value is set in the Declarations page of the manifest editor. If you are manually creating the manifest file, the background task is declared in the BackgroundTasks element, which is a child of the Extensions element.
In addition to the contents of your app's primary tile, your app's secondary tile content can also be reflected on the lock screen. You have two options to declare that capability:
- Provide a badge logo, through the LockScreenBadgeLogo property, that will represent the secondary tile on the lock screen. This logo should be a different image than the badge logo used for the parent app, but it must meet the same requirements.
- Optionally, you can also set the LockScreenDisplayBadgeAndTileText property to make the secondary tile eligible for the lock screen's detailed status slot.
Your app can ask the user to place the app on the lock screen. Call Windows.ApplicationModel.Background.BackgroundExecutionManager.requestAccessAsync to present a dialog box through which the user must explicitly select "allow" or "don't allow". In response, your app will receive one of the values in the BackgroundAccessStatus enumeration. The response depends both on what the user selected and the state of the other apps currently selected for that user's lock screen. Note that this method can only be used for an app's primary tile; the user must manually add eligible secondary tiles to the lock screen.
If all seven lock screen positions are already full when this request is made, the user is presented with a flyout that asks them to choose which of the existing apps that the new one should replace. Note, however, that to display detailed status, the user must manually assign your app to that slot. The programmatic request will not place you there or replace an app that already claims the slot.
Note An app is allowed to ask for lock screen access only once. The user can choose only one of the two options, so their preference will have been stated. Further calls to requestAccessAsync will be ignored. The single exception to this is the case where all seven lock screen slots are full and the user doesn't choose to replace an existing app with the app that's requesting access. In that case, a subsequent call to requestAccessAsync will display the confirmation UI. For more information, see Windows.ApplicationModel.Background.BackgroundAccessStatus.
The user is ultimately in control of what appears on their lock screen.
The user can manage which apps appear on their lock screen, the order they appear, and the single app that can display text updates. The user can do this by selecting PC settings from the Start screen and going to the Personalize page, shown in the image below. When the user selects one of the slots, a flyout is shown listing all of the eligible apps and secondary tiles from which to choose.
The user can toggle an app's lock screen rights (and associated background access) in the Permissions section of the app's Settings pane. Note that this only applies to the app's primary tile. The user must manually add secondary tiles to the lock screen through the Personalize page in PC Settings.
Once your app is on the lock screen, there is no additional work required to route notifications to the lock screen. Windows simply routes badge updates, tile updates, and toasts normally and they appear on the lock screen.
Note Tile notifications shown on the lock screen do not use the notification queue. Only the most recent tile update will appear on the lock screen, behaving like an app tile with the notification queue disabled.
- Lock screen app sample
- How to show notifications on the lock screen
- Guidelines and checklist for tiles and badges
- Badge overview
- Quickstart: Sending a tile update
- Quickstart: Sending a toast notification
- Secondary tiles overview
- Quickstart: Pinning a secondary tile