我有 InAppPurchases,我创建了服务
mService = IInAppBillingService.Stub.asInterface(service);
并将其与
Intent serviceIntent =
new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
context.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE);
然后我开始购买
JSONObject jsonObject = new JSONObject();
jsonObject.put("android_id", MainApplication.getInstance().android_id);
jsonObject.put("user_id", userId);
jsonObject.put("email", userEmail);
Bundle buyIntentBundle = mService.getBuyIntent(3, context.getPackageName(),
purchasingItemId, "inapp", jsonObject.toString());
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
if (pendingIntent != null) {
fragmentActivity.startIntentSenderForResult(pendingIntent.getIntentSender(),
MainApplication.ACTIVITY_RESULT_REQUEST_KEY.IN_APP_BILLING_PURHASING_RESPONSE,
new Intent(), Integer.valueOf(0), Integer.valueOf(0),
Integer.valueOf(0));
}
它工作正常,我看到带有预加载器的白卡 - 然后是购买信息,单击ok
,再次查看带有预加载器的白卡,然后是带有 的白卡Purchase successful
,但是如果我在看到购买信息之前最小化应用程序或Purchase successful
(当预加载器旋转时)然后再次打开它 - 我看到无限的预加载器并且没有任何反应,后退按钮不起作用(但购买成功并且用户在后台获取他的物品)并且摆脱它的唯一方法是重新启动应用程序
这就是它的外观 - https://imgur.com/II9GoSl
为什么会发生这种情况以及如何避免?