- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有 InAppPurchases,我使用
创建了服务mService = IInAppBillingService.Stub.asInterface(service);
并用
绑定(bind)它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));
}
工作正常,我看到带有预加载器的白卡 - 然后购买信息,单击确定
,再次看到带有预加载器的白卡,然后看到带有购买成功
的白卡,但是如果我在看到购买信息或购买成功
之前最小化应用程序(当预加载器旋转时),然后再次打开它 - 我看到无限的预加载器,没有任何反应,后退按钮不起作用(但购买成功并且用户在后台获取他的元素)并且仅摆脱它的方法 - 重新启动应用程序
这就是它的样子 - /image/MIZhq.jpg
为什么会发生这种情况以及如何避免它?
最佳答案
这是一种可能的解决方案:
在 InAppPurchase
Controller 中添加一个标志,用于启动您的应用内购买 Intent
public volatile boolean inAppFragmentOpened = false;
在发送 Intent 之前将其设置为true
,并在购买结束时将其设置为false
然后,在Activity
的方法onStart()
中添加此检查
if (InAppBillingFacade.getInstance().inAppFragmentOpened) {
InAppBillingFacade.getInstance().inAppFragmentOpened = false;
Intent i = new Intent(this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
如果启动时出现打开的应用内购买
窗口,这将重新启动您的应用程序 - 它可以帮助避免出现故障和卡住,但也许有人知道更好的解决方案?
关于java - IInAppBillingService 陷入购买叠加层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46340453/
我有 InAppPurchases,我使用 创建了服务 mService = IInAppBillingService.Stub.asInterface(service); 并用 绑定(bind)它
最近我为我的安卓应用实现了应用计费 https://developer.android.com/google/play/billing/billing_integrate.html#billing-s
我正在尝试使用应用内结算库。 自 2 天以来它一直运行良好。现在,当我生成签名的 APK 时,它会显示 AGPBI: {"kind":"error","text":"Program type alre
根据版本说明,应用内结算版本 5 于 2015 年 2 月发布。 Version Notes 我找不到描述更新界面的 IInAppBillingService.aidl。 我已通过 SDK 管理器将
大家好,我有一个关于计费的问题,当我点击按钮时,我在另一个类中调用了这个方法: public void launchPurchase() { BillingManager.getInstanc
我正在使用 Android Studio,并且正在学习应用内结算教程 http://developer.android.com/google/play/billing/billing_integrat
当我运行下面的 Java for Android 代码时,在 GetItemList 类的 doInBackground 方法中调用 getSkuDetails 的行上出现 NullPointerEx
第一次尝试使用应用内结算 V3,目标是 Android 2.2(API 级别 8),使用 Eclipse。 创建了一个名为 com.android.vending.billing 的包(在/src 中
我正在开发 android 项目,我正在使用应用内购买。这一切都在 Ecipe 中运行,但我看到 Android Studio 有另一个更新,它修复了许多与库依赖项相关的问题,除了一个问题之外似乎确实
自从修改我的代码以使用 Android 计费库而不是示例应用程序中的旧 IABHelper 后,我收到了很多 ANR 以及下面的跟踪记录。任何人都知道如何解决这个问题?跟踪中没有一行我的代码。 "ma
近 2 个月以来,我一直在寻找以下问题的解决方案。我在我的应用程序中实现了一个库,其中还包括 IInAppBillingService.aidl 文件和来自 Google 的 In App Billi
问题仅发生在发布版本或生成签名的 apk 时,当我构建调试时 - 没有这样的问题。 将 AS 升级到版本 3.1 后立即出现问题 Program type already present: com.a
您好,我已将 IInAppBillingService.aidl 文件添加到 ../main/aidl/com/android/vending/billing/目录,但没有生成 java 文件。我错过
使用 Google 新的应用内结算库(第 3 版),它应该是 significantly easier将计费添加到一个人的应用程序中。开发人员博客中显示的代码(请参阅链接)看起来已经非常简单了。 但是
我有一个要求,我希望获得已消费的购买收据。因此排除了使用方法 getPurchases 的方法,因为它仅提供拥有但未消费的购买信息。我可以看到 getPurchaseHistory 的文档,它可以提供
我正在学习本教程: https://developer.android.com/google/play/billing/billing_integrate.html#billing-permissio
我正在尝试在 Android 应用程序中使用应用程序产品购买,我尝试将 IInAppBillingService.aidl 放在很多地方但没有人生成 Java 文件,这是我的应用程序结构: 谁能帮我找
我收到此错误。我该如何修复它? ERROR: Duplicate jar entry [com/android/vending/billing/IInAppBillingService$Stub$Pr
将 billingclient 升级到 2.1.0 时: implementation 'com.android.billingclient:billing:2.1.0'//from 2.0.1 我的
我是一名优秀的程序员,十分优秀!