java - getBuyIntent 返回 null API 版本 3 应用内结算

标签 java android

我已经在检查 Internet 连接,并且 Google Play 市场安装了最新的软件包版本。

基本上 Parable 失败是因为应用内购买的 buyIntent 在第一次使用后返回 null。

这是代码,我怀疑错误出在这个 block 中(没有其他地方)

我也从 catch block 返回了这个,但我不确定这是什么意思,包名称已更改,因为我不想显示我的应用程序。

错误:(不是来 self 的包,而是系统级别)

[79] InAppBillingUtils.getPreferredAccount: com.mypackage.appname: Account from first account - [jbC6uT04zd8tXCrK]

代码:

Bundle buyIntentBundle = null;
        try 
        {
            buyIntentBundle = 
                    mServiceConnection.mBillingService.getBuyIntent(
                    3, 
                    mContext.getPackageName(), 
                    mPurchaseCodesAsStrings[PurchaseType], 
                    "inapp", 
                    mDeveloperPayload
                );
        } 
        catch (RemoteException e) 
        {
            e.printStackTrace();
        }

        PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");

最佳答案

如果您使用 API 版本 3 并尝试重新购买 MANAGED 应用内产品,则会收到此错误。所有产品均使用版本 3 进行管理。

在尝试再次购买之前,您基本上必须消费已经存在的托管产品。

关于java - getBuyIntent 返回 null API 版本 3 应用内结算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17310548/

相关文章:

java - 在 hibernate 中加入数组

java - "Catching exception is not allowed"Checkstyle报告

android - androidx 和 com.android.support 之间的区别

android - 每秒定期更新小部件

android - 如何使用带参数的 <include/> 重用布局?

java - 如何查看GPRS/3G是否开启?

java - 从包中访问类

java - 谷歌日历,Java : Set up google event colour and event date from timestamp

java - List<Dog> 是 List<Animal> 的子类吗?为什么 Java 泛型不是隐式多态的?

java - 更快地读取文件