Question

I have a Windows Phone 8 App and some extra features, which can only be used with the full version.

So the user clicks on a button

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. Is this all I have to do?
  2. When the person buys the app, will the IsTrial automatically be set to false?
  3. How do I change the ContentIdentifier if I don't even know the Identifier for my app now?
  4. Can I change the ContentIdentifier before I put my app in the store?

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();

    }
Was it helpful?

Solution

Regarding your 2nd question.

Yes, Microsoft sets the LicenseInformation.IsTrial value based on user actions. If the user buys the app, then the IsTrial is set to false.

You should test all your purchase scenarios before submitting to the store. You test with the CurrentAppSimulator class. It works in conjunction with a local XML file. You populate the XML file with the simulated licenseinfomation for each scenario.

Regard question #3, you don't need specify a GUID, If you leave ContentIdentifier null the OS will look up your app GUID for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top