Android IABv3 getSkuDetails not returning Sku Details

旧巷老猫 提交于 2020-01-01 08:59:49

问题


I am currently battling with Android Iab v3.

I have previously been using the IabHelper class from Google to display available products with success. However, today it is no longer returning me anything.

The content of the querySku field passed to the getSkuDetails function of the IInAppBillingService in the IabHelper class is:

Bundle[{ITEM_ID_LIST=[com.app.android.credits.10, com.app.android.credits.25, com.app.android.credits.50]}]

What I get back in the bundle it return is:

Bundle[{DETAILS_LIST=[], RESPONSE_CODE=0}]

Since the time it has worked and now I have not altered the IabHelper code at all along with the code that displays the products. The important bit of code being:

private void getItemsForSale()
{
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.add(getResources().getString(R.string.ten_credits_product_id));
    skuList.add(getResources().getString(R.string.twenty_credits_product_id));
    skuList.add(getResources().getString(R.string.fifty_credits_product_id));

    mHelper.queryInventoryAsync(true, skuList, this);
}

@Override
public void onQueryInventoryFinished(IabResult result, Inventory inv)
{
    if(result.isFailure())
    {
         Log.d("DEBUG", "Error Inventory Query: " + result);
         AppMsg.makeText(BuyCreditsActivity.this, R.string.sorry_something_went_wrong, AppMsg.STYLE_ALERT).show();  
    }
    else
    {
         // Code here queries the inv object returned which has a blank array
    }
}

This is why I am so confused.

Does anyone have any idea as to what external factor might have caused this to start not returning any product details?


回答1:


I'm getting the same empty bundle since yesterday. This question is not the same thing, but it was asked recently, and seems to be related: Android inventory.getSkuDetails() returning null
(I have experienced this one too about 2 weeks ago)

First answer states: "they say they have made changes which requires the apk to be published before adding in app purchases they recommend uploading the apk to alpha testing channel and published (not in draft mode)."

I will try this, perhaps it solves the problem.

Update: I published the app, but the developer console wrote that the modifications does not take effect immediately. After some hours the problem existed, but today it works well.




回答2:


I had this same problem. In my case the following worked:

  1. Make sure it's actually published in alpha, beta, or production. If it appears, for example, as "Draft in Alpha" or beta then you haven't published in. Publishing means that you also need to upload the minimum required assets for Google Play, descriptions, content ratings, etc (See the APK, Store Listing, and Content Rating tabs in the developer console).
  2. At least for alpha and beta testing, there is a list of testers that you must create and add each tester's email. Look for the "Manage Testers" section in the Alpha Testing or Beta Testing tab.
  3. Each tester must also accept to be a tester. There is an opt-in URL link which you must send to your testers, and they must click on the link and accepts the conditions.
  4. After all that is done, you still have to wait about 1 hour before the purchase details start to appear.

Hope this helps!



来源:https://stackoverflow.com/questions/23914116/android-iabv3-getskudetails-not-returning-sku-details

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!