Detect If App's Live Tile Is Installed On Windows Phone

  • Estimated read time: 2 min read
  • Written by Chad Campbell on Jun 21st 2013

Overview

Windows Phone allows your app to be pinned to the Start screen. When pinned, your app is personified as a Live Tile. Sometimes, you may need to programmatically detect if a user has pinned your app to the Start screen. Thankfully, the Windows Phone API allows you to programmatically see if your app's live tile is pinned.

Programmatically Checking For Your App's Live Tile

The Windows Phone API exposes a class called ShellTile. The ShellTile class empowers you to ping an application's tiles. You can do this by querying the statically visible property named ActiveTiles as shown here:

int applicationTileCount = ShellTile.ActiveTiles.Count();
if (applicationTileCount == 0)
{
  // The user has not pinned your app to the start screen
}
else
{
  // Your app has a tile pinned.
}

You may be wondering why ShellTile.ActiveTiles is a list instead of an single instance. The reason why is because an app can be pinned multiple times. This gives your users the flexibility to pin your app multiple times. For instance, if your app displays sports scores, a user could pin an instance of your app for each team's score they want to appear on the start screen.


Comments

comments powered by Disqus

Chad Campbell
Chad Campbell

Chad is an independent software professional. He has been named a Microsoft MVP five times. His books have been translated into multiple languages and distributed worldwide. He holds a computer science degree from Purdue University, where he also studied psychology.

Chad has built sites, apps, frameworks, libraries, and platforms using Java, .NET, and Node. He's ran his own startups and has created software for Fortune 100 companies. In short, Chad knows how to create software. From ideation to delivery. From start-to-finish.


Follow Chad Online