How to create and show an Icon on the Lock Screen in Windows Phone

This article demonstrates how to create / show a lock screen icon that will identify your Windows Phone 8 app on the lock screen.

Here are a few quick steps you can follow:

Step1. Create a new Windows Phone 8 application project in Visual Studio.

Step2. Add a PNG image to your project, that will be displayed on the lock screen. Image requirements:

Size: 38 x 38

Type: PNG

Colors: The image must contain only white pixels, optionally  with some level of transparency

Add a sample icon that meets the mentioned requirements, in our case we will add the following LockScreenIcon.png file:


Step3: Go to WMAppManifest.xml, right click and select “OpenWith.”. Then select Source Code (Text) Editor as shown on the next screen shots:



Step4: Find the “DeviceLockImageURI” element inside the WMAppManifest.xml  and set :

  • IsRelative=”true”
  • IsResource=”false”
  • Specify the path to the lock screen icon

Step5: To enable application icon and count on the lock screen you will have to add a new element called  Extensions with a couple of extensions inside :

NOTE: You must add the new Extensions element immediately after the Tokens section! 

NOTE: In Windows Phone 8 you can show the following elements on the lock screen: Icon, Count and Text!

NOTE: Use ExtensionName=”LockScreen_Notification_IconCount” if you want to show tile`s count on the lock screen.

NOTE: Use ExtensionName=”LockScreen_Notification_TextField” if you want to show text updates on the lock screen.

<Extension ExtensionName="LockScreen_Notification_IconCount" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
<Extension ExtensionName="LockScreen_Notification_TextField" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />

IMPORTANT:  You should note that the information that is shown on the lock screen comes directly from the application’s primary tile.

Step6:  Add a new button in XAMl that will be used for updating the primary tile:

  <Button x:Name="btnUpdateTile" Content="Update tile" Click="btnUpdateTile_Click" />

In code behind you will need to updates the primary tile using ShellTile and FlipTilrData:. For example:

private void btnUpdateTile_Click(object sender, RoutedEventArgs e)
ShellTile primaryTile = ShellTile.ActiveTiles.FirstOrDefault();
ShellTileData tileData = new FlipTileData() { Count = 10 };

Step7. That`s it build, and run the app. It is important to know that user must select your application as one of the apps that can show notifications on the lock screen in order for the updates of your primary tile to also be displayed on the lock screen! This is done by going to  Settings/Lock Screen section on the device and then selecting your app in the notifications section. Your app has to be selected in one of the 5 available slots in the “Choose apps to show quick status” section:

NOTE: These settings must be done by the user on his device and can not be done via code!

image_10_10 image_18_5

Step8: To test the result in the emulator you should use the simulation dashboard. Just go to Tools->Simulation Dashboard in Visual Studio as shown below:


Next you should see the Control Settings screen from where you can switch between Locked and Unlocked screen:


Here is how the final result should look like:


image_20_5 image_22_5

Hope the article was helpful. You can download the full source code on OneDrive. You may also find helpful the following articles:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.