2

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
   }
}
  • Yes, I was struggling to figure out why my queryProducts was giving an empty list when I have the active subscription showing in the Play store app on same device... I removed all other accounts on the device and then it is working fine. This seems like a major bug in the Billing library – ProjectDelta Aug 24 '23 at 13:39

0 Answers0