在app结算中启动产品消费android

时间:2014-04-02 18:35:08

标签: android in-app-billing

对于测试,我想对特定产品发起消费请求。

我知道可以使用以下方式完成:

public void consumeItem() {
    mHelper.queryInventoryAsync(mReceivedInventoryListener);
}

IabHelper.QueryInventoryFinishedListener mReceivedInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
       public void onQueryInventoryFinished(IabResult result,
          Inventory inventory) {

          if (result.isFailure()) 
          {
              ShowToast("There seem to be a problem completing the process, Please try later",Toast.LENGTH_LONG);
          } 
          else 
          {
                 mHelper.consumeAsync(inventory.getPurchase(current_productid), mConsumeFinishedListener);
          }
    }
};

但是当我尝试这个时,我得到了:

  

04-02 21:32:33.586:E / IabHelper(16254):应用内结算错误:非法操作状态(queryInventory):未设置IAB助手。

那我怎么能这样做呢?

0 个答案:

没有答案