I'm working with UWP and trying to make the app with a trial version (1 month) and products purchase that make full version with expiration (1 month and 1 year).
The general idea is, when the user downloads for first time the app, he has a trial period of 1 month with ads. After the month of trial version the app asks that need to buy a product with a periord of time and with this remove adds. The problem is that I don't know how to make at same time the buy of full version and product expiration, or make the full version with expiration.
I believe the answer here is to use the Microsoft Store Engagement and Monetization SDK. The current license state of your app is stored as properties of the LicenseInformation class. So, in the trial period, the user is using a trial license and when they buy the app, they get the full license. Typically, you put the functions that depend on the license state in a conditional block i.e. enable or disable ads in your scenario.
void ReloadLicense()
{
if (licenseInformation.IsActive)
{
if (licenseInformation.IsTrial)
{
// Show the features that are available during trial only.
}
else
{
// Show the features that are available only with a full license.
}
}
else
{
// A license is inactive only when there' s an error.
}
}
Here is the link to the msdn documentation that talks about this in more detail.
Hope this helps.
来源:https://stackoverflow.com/questions/37618703/uwp-trial-version-and-products-purchase-that-make-full-version-with-expiration