Windows phone: how get current application id
Asked Answered
O

3

8

Is there any way to get ID of my application in app store without hardcode? I need to use this value it self, so this way http://forums.create.msdn.com/forums/p/88847/533072.aspx will not help.

Ostracoderm answered 18/5, 2012 at 5:9 Comment(0)
H
10

try this : var appId = Windows.ApplicationModel.Store.CurrentApp.AppId; it's documentation here

Hegel answered 2/4, 2014 at 11:15 Comment(1)
its not supported in windows phone 7Cephalization
S
3

A couple of people answered your question in the post that you linked.

One answer is to get the ProductID value from your WMAppManifest.xml file. This value WILL BE your marketplace application ID once the app is submitted. When your app is submitted the value in your WMAppManifest.xml file is changed to be the value for the marketplace. While using this value will not work when testing your app, it WILL work once it has been approved.

The second way to to start the submission process and go to the details page to get the URI for your app.

Simulated answered 18/5, 2012 at 5:58 Comment(0)
R
2

Use this in your code:

string appID = (from manifest in 
  System.Xml.Linq.XElement.Load("WMAppManifest.xml").Descendants("App") 
select 
manifest).SingleOrDefault().Attribute("ProductID").Value;

Keep in mind, you need to add System.Xml.Linq reference and also include the Namespace.

Riding answered 5/2, 2013 at 12:4 Comment(1)
As of now this code crashes in published builds with null refZaid

© 2022 - 2024 — McMap. All rights reserved.