ShareLinkTask – How to identify published app Url?

Launchers & Choosers is now a pretty known concept in Windows Phone and they extend the capabilities of your app by reducing the complexity to just a few lines of code. However most newbies ignore the fact that proper use of some of launchers can is not only beneficial for apps users but also for app promotion. I’m specifically talking about ShareLinkTask here.

ShareLinkTask as the name suggests allows you to share a link (Url) with external world and since in Windows Phone the social media are integrated within the phone with a single click user can share the link on multiple channels like Hotmail, Facebook, Twitter, etc. Since ShareLinkTask is an extension to ShareStatusTask, you can provide link to your own app such that each time user shares content from your app, your app gets promoted. (Since the purpose of post is technical we’ll keep the discussion of whether that’s a good practice or not aside)

The workaround is to read the ProductId attribute from WMAppManifest.xml file through code so that when the app is certified for marketplace your app has access to the new Product Id and makes use of it on runtime. Here’s the helper class to fetch that,