错误从android

时间:2016-06-23 08:58:17

标签: android google-play in-app-purchase in-app-billing

我第一次在应用内购物。所以请指导我一些好的解决方案。我试图删除并添加Playstore帐户清算数据等,但没有任何对我有用。所以请提出一些好的建议。这是我的问题。

我正在使用第三方API [link] [1]

进行应用内购买

[1]:https://github.com/anjlab/android-inapp-billing-v3但是当我点击购买时,google play会显示此对话框错误(从服务器[df-dic-02]检索信息时出错)。这是我正在使用的代码

public class Launcher extends Activity
        implements BillingProcessor.IBillingHandler{ 


bp = new BillingProcessor(this,license_key, this);

  @Override
    public void onBillingInitialized() {
        /*
         * Called when BillingProcessor was initialized and it's ready to purchase
         */
    }

    @Override
    public void onProductPurchased(String productId, TransactionDetails details) {
        /*
         * Called when requested PRODUCT ID was successfully purchased
         */
    }

    @Override
    public void onBillingError(int errorCode, Throwable error) {
        /*
         * Called when some error occurred. See Constants class for more details
         *
         * Note - this includes handling the case where the user canceled the buy dialog:
         * errorCode = Constants.BILLING_RESPONSE_RESULT_USER_CANCELED
         */
    }

    @Override
    public void onPurchaseHistoryRestored() {
        /*
         * Called when purchase history was restored and the list of all owned PRODUCT ID's
         * was loaded from Google Play
         */
    }

  @Override
    protected void onActivityResult(
            final int requestCode, final int resultCode, final Intent data) {
        if (!bp.handleActivityResult(requestCode, resultCode, data))
            super.onActivityResult(requestCode, resultCode, data);
    }
}

1 个答案:

答案 0 :(得分:0)

这个问题让我烦恼,直到我意识到我错过了输入产品ID。 你可能也想检查你的。

我正在使用Google的虚拟产品ID

"android.test.purchased"

和电话

billingProcessor.purchase(this, "android.test.purchased");

此调用应该起作用,并从Play商店中为您提供正常的虚拟响应