2013-10-12 3 views
0

인앱 구매 라이센스가 있다는 사실을 캐시해야합니까? 예를 들어 인터넷에 연결되어 있지 않은 사용자가있을 수 있습니다. 방법을 사용하여 각 응용 프로그램 시작시 라이센스를 확인하고 싶지 않습니다.Windows Phone 8에서 인앱 구매를 캐시해야합니까?

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

     } 
    } 

답변

1

아니요, 인앱 구매를 캐시 할 필요가 없습니다. Windows Phone 운영 체제가 LicenseInformation Class에 있습니다.

인터넷 연결이없는 경우 사용자는 인앱 구매도 할 수 없습니다. 따라서 사용자 라이센스가 손실 될 염려가 없습니다.

관련 문제