yanivtwin
yanivtwin

Reputation: 625

In App Billing Subscription , check if subscribed

I want to do a check if a user is subscribed to the app ,

My question is - is it possible to check it without entering a sku ?

this is what i'm doing now:

  IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
    public void onQueryInventoryFinished(IabResult result, final Inventory inventory) {
        if(inventory.hasPurchase(skutmp)) {
            return true;
}

What i want to do is to check if there are any purchases (without using a sku)

Is there any way to do so ?

EDIT :

The main idea is to do so without getting a list from my server , so is there maybe a way to get the products available in the store so i could check them ?

Upvotes: 1

Views: 1444

Answers (1)

yanivtwin
yanivtwin

Reputation: 625

If anyone need help with that I managed to find this link

https://developer.android.com/google/play/billing/billing_integrate.html

You basically need to set it up and than do

Bundle activeSubs = mService.getPurchases(3, "com.example.myapp",
               "subs", null);

The bundle at place 0 will contain an ArrayList with all your purchases so what I did is check the size of the ArrayList.

Upvotes: 1

Related Questions