【问题标题】:Windows Phone 8 IsTrial MarketplaceWindows Phone 8 IsTrial 市场
【发布时间】:2013-04-18 13:58:59
【问题描述】:

我有一个 Windows Phone 8 应用程序和一些额外功能,只能与完整版一起使用。

所以用户点击了一个按钮

if ((Application.Current as App).IsTrial)
{
    Buy()
}
else
{
    //full feature
}


private void Buy()
    {
        MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
        marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
        marketplaceDetailTask.ContentIdentifier = "82a23635-5bd9-df11-a844-00237de2db9e";
        marketplaceDetailTask.Show();
    }
  1. 这就是我所要做的吗?
  2. 当用户购买应用时,IsTrial 会自动设置为 false 吗?
  3. 如果我什至不知道 ContentIdentifier,我该如何更改 现在我的应用的标识符?
  4. 我可以在将应用放入商店之前更改 ContentIdentifier 吗?

App.xaml

    /// <summary>
    /// The LicenseInformation class enables an application to determine 
    /// if it is running under a trial license.
    /// </summary>
    private static LicenseInformation _licenseInfo = new LicenseInformation();


    /// <summary>
    /// This property is used to cache the license information while the application is running. 
    /// The application uses the property whenever the current license information needs to be checked.
    /// </summary>
    private static bool _isTrial = true;
    public bool IsTrial
    {
        get
        {
            return _isTrial;
        }
    }


    /// <summary>
    /// Check the current license information for this application
    /// </summary>
    private void CheckLicense()
    {

        _isTrial = _licenseInfo.IsTrial();

    }

【问题讨论】:

  • 你测试过你的代码吗?
  • 一切正常。但我的意思是如果我将我的应用程序放在应用程序商店中,当用户购买应用程序时,IsTrial 会自动设置为活动吗?我无法将 '(Application.Current as App).IsTrial' 设置为 true,因为它是 ReadOnly。
  • 有一些方法可以通过模拟购买来测试此代码。我建议你这样做。
  • 您在这篇文章中提出了 4 个问题。

标签: windows-phone-8 marketplace


【解决方案1】:

关于你的第二个问题。

是的,Microsoft 根据用户操作设置 LicenseInformation.IsTrial 值。如果用户购买了应用,则 IsTrial 设置为 false。

您应该在提交到商店之前测试所有购买场景。您使用CurrentAppSimulator class 进行测试。它与本地 XML 文件结合使用。您使用每个场景的模拟许可证信息填充 XML 文件。

关于问题 #3,您不需要指定 GUID,如果您将 ContentIdentifier 留空,操作系统会为您查找您的应用 GUID。

【讨论】:

  • 您的意思是说如果用户购买了应用程序,那么 IsTrail 设置为 false?
  • @Jeffv,是的,这就是我的意思。 :>
猜你喜欢
  • 2012-10-22
  • 1970-01-01
  • 2013-02-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多