我目前正在与Android Iab v3作斗争.
我以前一直在使用Google的IabHelper类来显示成功的可用产品.然而,今天它不再给我任何回报.
传递给IabHelper类中IInAppBillingService的getSkuDetails函数的querySku字段的内容是:
捆绑[{ITEM_ID_LIST = [com.app.android.credits.10,com.app.android.credits.25,com.app.android.credits.50]}]
我在返回的包中得到的是:
捆绑[{DETAILS_LIST = [],RESPONSE_CODE = 0}]
从它工作的时间开始,现在我根本没有改变IabHelper代码以及显示产品的代码.代码的重要部分是:
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
}
}
Run Code Online (Sandbox Code Playgroud)
这就是为什么我这么困惑.
有没有人知道外部因素可能导致开始没有返回任何产品细节?