Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Play Billing Library: onSkuDetailsResponse responseCode is 0, but the size of skuDetailsList is also 0

Tags:

I'm now using the new Play Billing Library

Basically, I followed the documentation to query available items to purchase

 SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();             params.setSkusList(skuList).setType(itemType);             mBillingClient.querySkuDetailsAsync(params.build(),                     new SkuDetailsResponseListener() {                          @Override                         public void onSkuDetailsResponse(int responseCode,                                                          List<SkuDetails> skuDetailsList) {                             listener.onSkuDetailsResponse(responseCode, skuDetailsList);                         } 

However, the responseCode is 0 and the list is also empty. But I checked onBillingSetupFinished is successful. The skuList that provided to SkuDetailsParams.Builder is not empty, and the values inside the skuList (sku_id) is also same as Product ID that specifies on Google Play Console.

Does anyone know the reason? Thanks!!

like image 279
TheOska Avatar asked Oct 17 '17 04:10

TheOska


2 Answers

I have spent few hours with this issue and the problem was that my debug build/CI builds had applicationIdSuffix. So only production build with proper applicationId was able to retrieve the products.

like image 137
hrach Avatar answered Nov 11 '22 11:11

hrach


Sounds like you're having issues with your Google Play Console setup.

Please check that:

  • your app is published in Play Console (to PROD or your @gmail account is in the user's alpha/beta group)
    • I also recommend adding your test @gmail account into license testers list to avoid being charged and license issues
  • has correct signature and version code of test app is equal to published one
  • all of your SKUs are also published
  • your Play Store app works correctly on the phone you're testing (allows you to purchase apps for example)

And wait for some time after setup is done.

like image 39
goRGon Avatar answered Nov 11 '22 12:11

goRGon