does anyone know how to get active subscription when more than 1 user accounts are logged in in Play Store? I've followed the steps in the documentation, it works normal when only 1 user logged in in the Play Store

Here is what i've done

val billingClient = BillingClient.newBuilder(context).setListener(purchasesUpdateListener)
                .enablePendingPurchases()
                .build()

//Starting connection
billingClient.startConnection(object : BillingClientStateListener {
   override fun onBillingSetupFinished(billingResult: BillingResult) {
       queryPurchasesAsync()
       queryPurchaseHistoryAsync()
   }

   override fun onBillingServiceDisconnected() {
       //Do something to reconnect
   }
})

fun queryPurchasesAsync(){
   billingClient?.queryPurchasesAsync(QueryPurchasesParams.newBuilder()
                .setProductType(BillingClient.ProductType.SUBS)
                .build()
   ) { result, purchases ->
      //Process puchases data
      //Result is always ok
      //purchases always return empty when 2 users are logged in in the Play Store, but return list of active subscription when only 1 user logged in in the play store
   }
}
1

There are 1 best solutions below

0
Mixdor On

It seems to be a bug in the library that has been happening for a long time. I had the same issue with in-app purchases using the Billing library v6, and it was resolved when I cleared the data and cache of Google Play Services on the affected phone. I hope this helps someone.