Previously, to get the product id, the getSku() method was used, which returned singular value.
In the 4.0.0 version of the BillingClient library, the getSkus() method was added (https://developer.android.com/google/play/billing/release-notes#4-0)
In version 5.0.0, the getSku() method was removed totally, and getSkus() was replaced with getProducts(), whose documentation says just “Returns the product Ids.” (https://developer.android.google.cn/reference/com/android/billingclient/api/Purchase?hl=zh-cn#getProducts())
I cant google any information, why product can have multiple identifiers now?
Since v5.0.0 BillingFlowParams.Builder has setProductDetailsParamsList() method which indicates there can be multiple products included within one purchase, so to be consistent with this Purchase has the getProducts() method which returns a list.
(The sample code uses ImmutableList but with only a single item: https://developer.android.com/google/play/billing/integrate#launch)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With