Some of my users tell me that my app forgets the purchased subscriptions every now and then. It works for 3-4 days and then it forgets them. This is a very important issue as users might suspect fraud. I am using billing library 4.0.0 and I have implemented the billing logic as per Google's guidelines.
From what I have gathered it happens when for some reason the billing service connection is interrupted. (Play Store is updating for example)
I have managed to replicate this scenario the following way
- Disable internet connection - Clearing Play Store app data - Fresh launch of my app. - Call billingClient.startConnection() onBillingSetupFinished called with responseCode BILLING_UNAVAILABLE user sees -> The app says "no subscription purchased" - Enable internet connection - re-initialize BillingClient. onBillingSetupFinished called with responseCode OK. billingClient.isReady() returns true. - Call billingClient.queryPurchasesAsync() and billingClient.querySkuDetailsAsync(). onSkuDetailsResponse is called with the skuDetailsList filled with all the proper data. However: onQueryPurchasesResponse is called with empty purchase list -> Again user sees "no subscriptions purchased"
Important If at this point I open Play Store it shows the purchased subscriptions. But the app still gets an empty purchases list.
If I keep calling
billingClient.queryPurchasesAsync() at some point after about 10 minutes one attempt will succeed and return a non empty purchases list.
Is it possible to tell Play Store to refresh its subscription data for my app? How can someone handle this scenario gracefully ?