Esempio n. 1
0
		private int querySkuDetails(string itemType, Inventory inv, IList<string> moreSkus)
		{
			logDebug("Querying SKU details.");
			List<string> skuList = new List<string>();
			skuList.AddRange(inv.getAllOwnedSkus(itemType));
			if (moreSkus != null)
			{
				foreach (string sku in moreSkus)
				{
					if (!skuList.Contains(sku))
					{
						skuList.Add(sku);
					}
				}
			}

			if (skuList.Count == 0)
			{
				logDebug("queryPrices: nothing to do because there are no SKUs.");
				return BILLING_RESPONSE_RESULT_OK;
			}

			Bundle querySkus = new Bundle();
			querySkus.PutStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
			Bundle skuDetails = mService.GetSkuDetails(3, mContext.PackageName, itemType, querySkus);

			if (!skuDetails.ContainsKey(RESPONSE_GET_SKU_DETAILS_LIST))
			{
				int response = getResponseCodeFromBundle(skuDetails);
				if (response != BILLING_RESPONSE_RESULT_OK)
				{
					logDebug("getSkuDetails() failed: " + getResponseDesc(response));
					return response;
				}
				else
				{
					logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
					return IABHELPER_BAD_RESPONSE;
				}
			}

			IList<string> responseList = skuDetails.GetStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

			foreach (string thisResponse in responseList)
			{
				SkuDetails d = new SkuDetails(itemType, thisResponse);
				logDebug("Got sku details: " + d);
				inv.addSkuDetails(d);
			}
			return BILLING_RESPONSE_RESULT_OK;
		}
Esempio n. 2
0
 public void addSkuDetails(SkuDetails d)
 {
     mSkuMap[d.Sku] = d;
 }