In-App Billing test: android.test.purchased already owned

后端 未结 16 1446
情深已故
情深已故 2020-12-07 08:09

I am currently testing In-App Billing for a future app, and after I successfully \"bought\" the test item \"android.test.purchased\" the first time, I now receive the respon

16条回答
  •  孤街浪徒
    2020-12-07 08:43

    The main issue is you have to consume the android.test.purchased item. But this item won't be available in your query inventory, so you can't consume using the normal flow.

    So, if you are using IabHelper, in IabHelper class, you can temporarily change the IInAppBillingService mService to public so that it is accessible from your IabHelper.

    Then in your class, you can consume like this,

    int response = mHelper.mService.consumePurchase(3, getPackageName(), "inapp:"+getPackageName()+":android.test.purchased");
    

    If success, the response is going to be 0.

    Hope this helps.

提交回复
热议问题