By using this code given below we can share our windows
phone application (Before first time publish) on social sites like Facebook etc.
In order to dynamically create the link all we have to do is read the manifest file, get the "ProductID" attribute value, and then create the link with the expected format; with this data, we can write a class in C# such as this:
Fig: Code to extract data from WMAppManifest.xml |
The most important part of this class is the GetManifestAttributeValue(string) function, that will access the WMAppManifest.xml file and from there retrieve the required information.
Once we have the ApplicationId, we will then use it along the BuildApplicationDeepLink(string) function to return the final link!
Now all we have to do is add this class to our project and then invoke the DeepLinkHelper.BuildApplicationDeepLink() function to retrieve the application deep link, and do with it whatever we'd like (send by email, share on social networks, ...)!.
You will be thinking why should we need to write this code to extract the "ProductId" from Manifest file because we can simply copy paste ProductId from our Project's WMAppManifest.xml to our code. So why we need to write the above code.?? .
Its because: "During the app submission process, a new product ID is inserted into the manifest file".
Fig: WMAppManifest.xml attributes description |
So Whenever the new Product Id is assigned, the above code will retrieve that Id. In this way we can share our Application Successfully! :) .
For details of WMAppManifest.xml file attributes you can visit : http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769509(v=vs.105).aspx.
You can download the source code from here : Share This Application C#