S.A.Parkhid S.A.Parkhid - 1 year ago 226
Android Question

Google In App BIlling Returns Null Purchases when calling getPurchases

I had writing an IAB(In App Billing) application . the premium purchase will be submitted into google dashboard and also I can see the invoice of that item and user cannot buy this item twice. so this is ok.

But by using code below I cannot understand that the user is premium or not, because the premiumPurchase is always null. ( I am calling this method in on setup finished listener)

mHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

if (mHelper == null) return;

if (result.isFailure()) {


Purchase premiumPurchase = inventory.getPurchase(SKU_PREMUIM);

if(premiumPurchase!=null) {

lblIsPremuim.setText("You are Premium");
lblIsPremuim.setText("You are Not Premium");
Toast.makeText(getApplicationContext(),"not permuim",Toast.LENGTH_SHORT).show();


I had restarted the device and clear the cache of Google Play and I am sure that I have signed in with correct account. the base-64 public key is surely correct and I had read all posts in Stack-Over-Flow which has been mentioned about this issue but not finding a solution. I am using same version name and version code and same key store with uploaded app.

Answer Source

Finally after some days I had solved the problem by manipulating the AndroidManifest.XML file:

1) I had removed permission below: ( because I had thought that is conflicting with billing permission) , but possibly you can leave this line .

<uses-permission android:name="android.permission.INTERNET" />

2) I notified that there is such line in my AndroidManifest.xml:

        android:maxSdkVersion="9" />

So by above statement, min is more than max version , it is not logical , so I have changed this to below:

        android:targetSdkVersion="15" />

After that I cleaned the project and make a rebuild and also restarting the device.then I can get my all purchases...

Very Important update : you should sign in sign out from your google store app.