i'm experiencing a frustrating issue with in-app billing process. I've created a new application in dev console, added an inapp product named "P1", which is currently active; I've uploaded my app to the store in alpha version, then promoted to beta, added a tester account and installed the apk on a device (tablet) signed with the tester account and another with dev account.
Now, i'd like to query the store to get informations like price of not owned skus. Here's my code from my activity:
private void istantiate() {
List<String> tmp = new List<String>();
tmp.add("P1");
final List<String> skus = tmp;
mHelper = new IabHelper(mContext, base64EncodedPublicKey);
// enable debug logging (for a production application, you should set this to false).
mHelper.enableDebugLogging(true);
//create listener
bListener = new BillingListener(mHelper, mContext);
// Start setup. This is asynchronous and the specified listener will be called once setup completes.
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// There was a problem.
return;
}
getInventory(skus);
}
});
}
...
private void getInventory(List<String> skuList) {
// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null) return;
// IAB is fully set up. Now, let's get an inventory of stuff we own.
mHelper.queryInventoryAsync(true, skuList, bListener.mQueryFinishedListener);
}
Then when query is completed, this piece of code is called:
IabHelper.QueryInventoryFinishedListener mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (result.isFailure()) {
// handle error
return;
}
...
}
};
But returned inventory is empty. Here's logcat:
12-13 11:21:36.977: D/IabHelper(6034): Billing service connected.
12-13 11:21:36.977: D/IabHelper(6034): Checking for in-app billing 3 support.
12-13 11:21:36.987: D/IabHelper(6034): In-app billing version 3 supported for ***
12-13 11:21:36.987: D/IabHelper(6034): Subscriptions AVAILABLE.
12-13 11:21:36.987: D/IabHelper(6034): Starting async operation: refresh inventory
12-13 11:21:36.987: D/IabHelper(6034): Querying owned items, item type: inapp
12-13 11:21:36.987: D/IabHelper(6034): Package name: ***
12-13 11:21:36.987: D/IabHelper(6034): Calling getPurchases with continuation token: null
12-13 11:21:36.997: D/IabHelper(6034): Owned items response: 0
12-13 11:21:36.997: D/IabHelper(6034): Continuation token: null
12-13 11:21:36.997: D/IabHelper(6034): Querying SKU details.
12-13 11:21:37.097: D/IabHelper(6034): Querying owned items, item type: subs
12-13 11:21:37.097: D/IabHelper(6034): Package name: ***
12-13 11:21:37.097: D/IabHelper(6034): Calling getPurchases with continuation token: null
12-13 11:21:37.097: D/IabHelper(6034): Owned items response: 0
12-13 11:21:37.097: D/IabHelper(6034): Continuation token: null
12-13 11:21:37.097: D/IabHelper(6034): Querying SKU details.
12-13 11:21:37.097: D/IabHelper(6034): Ending async operation: refresh inventory
It's about a week since my inapp product was published, so it isn't a matter of time. I've tried to clear app data, and restart the device.
Edit: Everything works fine using android.test.purchased as test sku.
Edit 2: SKUs are "unmanaged"
I also got this problem but it was fixed once I cleared app data for Google Play application. Using adb:
adb shell pm clear com.android.vending
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With