I have successfully implemented in app billing into my app which all works fine. I am now trying to retrieve the price of items (set in developer console) so that I can reflect
Ok, I have found the solution. I have deciphered the developer docs and it appears there were errors in it.
This is my solution created within IabHelper:
public String getPricesDev(String packageName) throws RemoteException, JSONException{
ArrayList skuList = new ArrayList();
skuList.add("full.discount.fetch");
skuList.add("gas");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
Bundle skuDetails = mService.getSkuDetails(3,packageName, "inapp", querySkus);
int response = skuDetails.getInt("RESPONSE_CODE");
if (response == 0) {
ArrayList responseList
= skuDetails.getStringArrayList("DETAILS_LIST");
for (String thisResponse : responseList) {
JSONObject object = new JSONObject(thisResponse);
String sku = object.getString("productId");
String price = object.getString("price");
if(sku.contains("full.discount.fetch")) return price;
}
}
return "Not found";
}