summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvolzhs <volzhs@gmail.com>2017-05-19 12:20:51 +0900
committervolzhs <volzhs@gmail.com>2017-05-19 12:20:51 +0900
commit209f61b6d4aacfc4d255567030b3ec0932ce40fc (patch)
treee3535029697f3f2a4767e606a2bd7c607fe5d20b
parentd801ff2b3db2de105c1b36a74ce116e360143d4e (diff)
Fix android payment logical error
getting sku detail runs only if mod != 0 which means querying 20*n will not get sku details. referenced from https://github.com/googlesamples/android-play-billing/blob/master/TrivialDrive/app/src/main/java/com/example/android/trivialdrivesample/util/IabHelper.java#L1029-L1062
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java47
1 files changed, 23 insertions, 24 deletions
diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
index 044efba1f3..6f308af360 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
@@ -355,36 +355,35 @@ public class PaymentsManager {
tempList.add(s);
}
packs.add(tempList);
-
- for (ArrayList<String> skuPartList : packs) {
- Bundle querySkus = new Bundle();
- querySkus.putStringArrayList("ITEM_ID_LIST", skuPartList);
- Bundle skuDetails = null;
- try {
- skuDetails = mService.getSkuDetails(3, activity.getPackageName(), "inapp", querySkus);
- if (!skuDetails.containsKey("DETAILS_LIST")) {
- int response = getResponseCodeFromBundle(skuDetails);
- if (response != BILLING_RESPONSE_RESULT_OK) {
- godotPaymentV3.errorSkuDetail(getResponseDesc(response));
- } else {
- godotPaymentV3.errorSkuDetail("No error but no detail list.");
- }
- return;
+ }
+ for (ArrayList<String> skuPartList : packs) {
+ Bundle querySkus = new Bundle();
+ querySkus.putStringArrayList("ITEM_ID_LIST", skuPartList);
+ Bundle skuDetails = null;
+ try {
+ skuDetails = mService.getSkuDetails(3, activity.getPackageName(), "inapp", querySkus);
+ if (!skuDetails.containsKey("DETAILS_LIST")) {
+ int response = getResponseCodeFromBundle(skuDetails);
+ if (response != BILLING_RESPONSE_RESULT_OK) {
+ godotPaymentV3.errorSkuDetail(getResponseDesc(response));
+ } else {
+ godotPaymentV3.errorSkuDetail("No error but no detail list.");
}
+ return;
+ }
- ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
+ ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
- for (String thisResponse : responseList) {
- Log.d("godot", "response = "+thisResponse);
- godotPaymentV3.addSkuDetail(thisResponse);
- }
- } catch (RemoteException e) {
- e.printStackTrace();
- godotPaymentV3.errorSkuDetail("RemoteException error!");
+ for (String thisResponse : responseList) {
+ Log.d("godot", "response = "+thisResponse);
+ godotPaymentV3.addSkuDetail(thisResponse);
}
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ godotPaymentV3.errorSkuDetail("RemoteException error!");
}
- godotPaymentV3.completeSkuDetail();
}
+ godotPaymentV3.completeSkuDetail();
}
})).start();
}