SaravanaKumar
SaravanaKumar

Reputation: 747

How to create the "Buy & try" option in Windows Phone 8

Is that possible to make the buy & try options in windows phone 8 like in the windows store apps.

One of my game in the windows store is full access for one week from the day of download. After that windows store itself locks the game(If we give 1 week in the dashboard).

Like that, windows phone 8 having any of the features.


http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh286402(v=vs.105).aspx#BKMK_Runningtheapplication

Even i tried for Buy & try using the above link.

I changed the checklicense() like below.

private void CheckLicense()
    {
        if DEBUG
        string message = "This sample demonstrates the implementation of a trial mode in an application." +
                           "Press 'OK' to simulate trial mode. Press 'Cancel' to run the application in normal mode.";
        if (MessageBox.Show(message, "Debug Trial",
             MessageBoxButton.OKCancel) == MessageBoxResult.OK)
        {
            _isTrial = true;
        }
        else
        {
            _isTrial = false;
        }
        else
        _isTrial = _licenseInfo.IsTrial();
        //Included lines
        if(_isTrail)
            freeversion = true;   //Here Free version trigger when user presses Try
        else
            freeversion = false;   //Here fullversion trigger when user presses Buy
        //Included lines
       endif
    }

If i did like this. I run it in the Master Mode. It always goes for freeversion is false.(i.e: _isTrail is always returns false).

Its because of I have not yet uploaded to windows phone store or some other problem?? How can I do this?

Upvotes: 1

Views: 609

Answers (2)

Ethan
Ethan

Reputation: 178

Here is the code that i used:

private void CheckLicense()
{
   LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
            try
            {
                var listing = await CurrentApp.LoadListingInformationAsync();
                var _price = listing.FormattedPrice;
                // start product purchase
                await CurrentApp.RequestProductPurchaseAsync("FeatureName", false);

                ProductLicense productLicense = null;
                if (CurrentApp.LicenseInformation.ProductLicenses.TryGetValue("FeatureName", out productLicense))
                {
                    if (productLicense.IsActive)
                    {
                        MessageBox.Show("Product purchased");

                        CurrentApp.ReportProductFulfillment("FeatureName");
                         ProductPurchased();       // It display product purchased & trigger full version
                         return;
                    }
                    else
                    {
                        str = "Purchase failed";
                       ShowErrorPopup(str); // It shows error msg. purchase failed.
                       return;
                    }
                }
           }
           catch (Exception)
            {
                str = "Purchase failed. Check internet connection and try again";
                ShowErrorPopup(str);
                return;
            }
}

Upvotes: 1

Kevin Gosse
Kevin Gosse

Reputation: 39007

There is no automated way to do that on Windows Phone, you'll have to implement the trial limitation yourself in the app.

Note that uninstalling an app on Windows Phone leaves no traces. Therefore, users will be able restart the trial period if they uninstall/reinstall the app.

Upvotes: 2

Related Questions