要跟踪使用我们的Windows Phone 8应用程序进行的应用程序内购买,我们想知道从应用程序内部购买的货币.现在我们使用FormattedPrice属性知道价格,如下所示:
public static async void LoadProductListing()
{
ListingInformation listings = await CurrentApp.LoadListingInformationAsync();
ProductListing product = listings.ProductListings["SomeProductID"];
String price = product.FormattedPrice;
}
Run Code Online (Sandbox Code Playgroud)
这导致价格仅使用€0,99或等符号格式化$0.99.因为€这是好的,因为$这不是足够的信息:我们仍然不知道它是美元,加元,澳元还是智利比索(这也是美元).我们希望有一个正确的信息ISO 4217货币代码(如EUR,USD,CAD,AUD,CLP),或者至少说明确切的货币符号(如US$,C$等).
在Windows 8上,可以使用该ListingInformation.CurrentMarket属性来获取当前市场的区域设置(以及使用的货币),但文档中有一条注释:
Windows Phone 8
This API is not implemented and will throw an exception if called.
Run Code Online (Sandbox Code Playgroud)
我们使用系统区域设置进行重新调整是不够精确的:它可能与用于当前市场的区域设置不同(但我们可能错在那里!).
有没有办法从Windows Phone 8应用程序中正确确定应用内购买货币?