0

アプリ内購入のライセンスを持っているという事実をキャッシュする必要がありますか? たとえば、ユーザーがインターネットに接続していない可能性があります。という方法で、アプリケーション起動ごとにライセンスを確認したくありません。

await CurrentApp.LoadListingInformationAsync();

アプリ内購入を IsolatedStorage にキャッシュする必要はありますか? 例えば:

    /// <summary>
    /// Get list of In-app purchased
    /// </summary>
    /// <returns></returns>
    public async Task<List<string>> GetOwnedItems()
    {
        var settings = IsolatedStorageSettings.ApplicationSettings;

        List<string> items = (List<string>)settings["PurchasedProducts"];

        if (!items.Any()) //TODO If no purchases, call this block one time, no more!!!
        {
            ListingInformation li = await CurrentApp.LoadListingInformationAsync();
            items = new List<string>();

            foreach (string key in li.ProductListings.Keys)
            {
                if (CurrentApp.LicenseInformation.ProductLicenses[key].IsActive)
                    items.Add(key);
            }

           //Save to IsolatedStorage
           settings["PurchasedProducts"] = items;
        }

        return items;
    }

    public async void PurcaseItem(string itemKey)
    {
        if (!Store.CurrentApp.LicenseInformation.ProductLicenses[itemKey].IsActive)
        {
            ListingInformation li = await Store.CurrentApp.LoadListingInformationAsync();
            string pID = li.ProductListings[itemKey].ProductId;

            string receipt = await Store.CurrentApp.RequestProductPurchaseAsync(pID, false);

            var settings = IsolatedStorageSettings.ApplicationSettings;

            //TODO Add key to Isolated storage
            List<string> items = ((List<string>)settings["PurchasedProducts"]).Add(pID);

        }
    }
4

1 に答える 1

1

いいえ、アプリ内購入をキャッシュする必要はありません。Windows Phone オペレーティング システムは、LicenseInformation クラスでそれを行います。

インターネット接続がない場合、ユーザーはアプリ内購入もできません。そのため、ユーザー ライセンスの損失を心配する必要はありません。

于 2013-10-14T11:57:24.603 に答える