Reputation: 20738
I want to open Windows Store of my current application (so the user can rate/review out app). In doing so, I need to get the App ID. However, I come across this article in SO that says CurrentApp.AppId
takes a lot of time, and offer Package ID as substitution. I have never released a app on Windows Store before, and cannot test it now without a released/published app on Windows Store.
Can anyone help me confirm about the following two lines of code?
//var appId = CurrentApp.AppId.ToString();
var appId = Windows.ApplicationModel.Package.Current.Id;
Upvotes: 8
Views: 3520
Reputation: 15758
No, AppId
and PackageId
are not identical.
As you can see AppId
is a Guid
structure while PackageId
is a class. AppId
is generated by the Windows Store when your app has been certified for listing in the Windows Store, while PackageId
provides package identification info, such as name, version, and publisher which can be found in your appx manifest.
As the AppId
is related to the Windows Store, so the first time when you try to obtain it, it may takes some time. But this won't be too long, in my test it's around 1 second. After this, when you try to obtain the AppId
again, it will be very quick. (I think it has been stored in local machine as its value is invariant.)
However, if you want to launches the product details page (PDP) for a product. Product ID is recommended for customers on Windows 10. And the Product ID is not the AppId
.
To get the Product ID, as Launch the Windows Store app said:
These values can be found in the Windows Dev Center dashboard on the App identity page in the App management section for each app.
To get it programmatically, we can try to use CurrentApp.LinkUri property, this property returns the URI of the app's listing page in the Windows Store like:
https://www.microsoft.com/store/apps/<your app's Product ID>
.
The Product ID is also invariant, so I think you can just find it in Windows Dev Center dashboard and hardcode it in your app.
Upvotes: 7
Reputation: 436
This should get you what you want:
await Launcher.LaunchUriAsync(new Uri($"ms-windows-store:REVIEW?PFN={Package.Current.Id.FamilyName}"));
The Store will handle the ms-windows-store:
protocol, and the arguments will point it to your app's "Rate and Review" section.
Upvotes: 1