Wonton
Wonton

Reputation: 1143

Android inapp billing getSkuDetails return null

I've developed an Android app which includes inapp purchases (non consumables) and everything is working fine.

Now I have to create a new PRO version of my app which instead of having non consumable products has subscription products.

This is what I've done:

  1. Created a new flavor called pro.
  2. Changed the applicationId of this new flavor from com.mydomain.mypackage to com.mydomain.mypackage.pro.

I can compile and install my free and pro flavors both in debug and release mode without problems and both versions are simultaneously installed in my device, and shows their respective names and icons, so I guess I've done these 2 steps right.

  1. Created in Google a new application with id com.mydomain.mypackage.pro.
  2. Filled all the fields and images in the Google developer console so the new app is fully configured and ready to be published (it shows a green check).
  3. Created 4 subscriptions items with these ids com.mydomain.mypackagepro.plan1monthly, com.mydomain.mypackagepro.plan1annual, com.mydomain.mypackagepro.plan2monthly and com.mydomain.mypackagepro.plan2annual. They are all active. Please, note that in these ids I've used mypackagepro instead of mypackage.pro, I guess this is not a problem.
  4. In my code for pro flavor I set the InApp Billing key to the new one, taken from Services and APIs.
  5. In my code I ask for the new items ids using the code I used for my previous version, so I guess it's ok becuase it was working fine with inapp consumable items. I've double checked that the ids requested are equal to those I've set in Google Play console.
  6. Generated the signed APK for pro flavor in release mode.
  7. Installed this APK in my device.
  8. Uploaded this APK to my Alpha channel and published it (I'm pretty sure it's published and not in draft mode or something similar). I've added 2 accounts as testers (one of them is my own developer account) to this channel.

After this, if I launch my app, the inventory returned is empty (I guess this is ok because I haven't purchase any subscription yet), but if I request the details of these Ids, the method getSkuDetails returns null for the 4 items.

I've waited for 10 hours just in case the apk wasn't completely published. But after these 10 hours, the problem continues, queryInventoryAsync returns an empty inventory and getSkuDetails returns null for each subscription.

Am I missing something??

--- EDIT ---

I have to add more information. After double checking that the app is published as Alpha, I've tried to download it using this link:

https://play.google.com/apps/testing/com.mydomain.mypackage.pro

This shows me a webpage telling me that I've been invited to test the app and that I have to accept the invitation.

Besides this there is a link to download the app from Play Store. So I accept the invitation and download+install the app from Play Store. I was pretty sure that this would fix the error but unfortunately the problem is still there, each time I call getSkuDetails for the subscription the method returns null.

So:

But, getSkuDetails returns null.

Upvotes: 0

Views: 563

Answers (1)

Wonton
Wonton

Reputation: 1143

I finally found my problem. I was calling

mHelper.queryInventoryAsync(true, additionalSkuList, null, mQueryFinishedListener);

passing the subscriptions in the field for inapp items. Once I've done this, my app is working:

mHelper.queryInventoryAsync(true, null, additionalSkuList, mQueryFinishedListener);

Upvotes: 1

Related Questions