在我看来,我一次只能在Google App中购买一项。
代码A来自项目play-billing-samples,您可以看到here。
purchases: MutableList<Purchase>
可能存在多个物品,看来我可以通过Google Play同时购买这些物品,对吗?
代码A
override fun onPurchasesUpdated(
billingResult: BillingResult,
purchases: MutableList<Purchase>?
) {
when (billingResult.responseCode) {
BillingClient.BillingResponseCode.OK -> {
// will handle server verification, consumables, and updating the local cache
purchases?.apply { processPurchases(this.toSet()) }
}
BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED -> {
// item already owned? call queryPurchasesAsync to verify and process all such items
Log.d(LOG_TAG, billingResult.debugMessage)
queryPurchasesAsync()
}
BillingClient.BillingResponseCode.SERVICE_DISCONNECTED -> {
connectToPlayBillingService()
}
else -> {
Log.i(LOG_TAG, billingResult.debugMessage)
}
}
}
一个用户只能拥有一次相同的应用内商品,但是他可以同时拥有不同