#StackBounty: #android #google-play #in-app-billing How to check if the user has an active subscription in Android, Google Play?

Bounty: 500

I have an app with a subscription in Google Play.
When the user starts the app, I need to know if the user has an active subscription. This would seem an obvious thing to do, but from searching and trying to implement it, it seems impossible?

I am using Google’s newer billing 2/3, following Google’s tutorials,

class BillingManager implements PurchasesUpdatedListener
public void checkAsync() {
    Log.e(TAG, "checkAsync");
    billingClient.queryPurchaseHistoryAsync(BillingClient.SkuType.SUBS, new PurchaseHistoryResponseListener() {
        public void onPurchaseHistoryResponse(BillingResult billingResult, List<PurchaseHistoryRecord> list) {
            Log.e(TAG, "checkCached result: " + list);
            if (list == null) {

            for (PurchaseHistoryRecord ps : list) {
                //System.out.println("PAYMENT: " + ps.getSku() + " : " + ps.getPurchaseTime());

public void checkCached() {
    Log.e(TAG, "checkCached");
    List<Purchase> result = billingClient.queryPurchases(BillingClient.SkuType.SUBS).getPurchasesList();
    Log.e(TAG, "checkCached result: " + result);
    if (result == null) {
    for (Purchase purchase : result) {

This is how I think you’re supposed to get a user’s purchases. But it does not work at all, both calls return null always. It only returns the correct purchases when you reinstall the app or clear the data.

So how exactly is an app supposed to do this?

Purchasing works for the app once I enter internal testing, and download it through the Google Play link. (before that subscriptions do not work at all).

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.