我已经将我的Kotlin应用程序从4.0升级到了android billing 5.0,因此,SkuDetails现在已不推荐使用,所以我正在使用migration instructions迁移到ProductDetails.
之前,我使用SkuDetails.price向用户显示应用内购买的购买价格,但在ProductDetails中找不到类似的方法.
在Google Play Billing Library 5.0中,是否有一种非弃用的方式来检索应用内购买或订阅的价格?
我已经将我的Kotlin应用程序从4.0升级到了android billing 5.0,因此,SkuDetails现在已不推荐使用,所以我正在使用migration instructions迁移到ProductDetails.
之前,我使用SkuDetails.price向用户显示应用内购买的购买价格,但在ProductDetails中找不到类似的方法.
在Google Play Billing Library 5.0中,是否有一种非弃用的方式来检索应用内购买或订阅的价格?
基于documentation,你可以在ProductDetails上调用getOneTimePurchaseOfferDetails()
来返回ProductDetails.OneTimePurchaseOfferDetails
对象,它有一个getFormattedPrice()
方法来返回应用内购买的价格.
对于订阅,您可以调用getSubscriptionOfferDetails()
,它返回ProductDetails.SubscriptionOfferDetails
个对象的列表,其中有一个getPricingPhases()
方法来返回不同的定价阶段.pricing phase个对象有一个getFormattedPrice()
方法来获取价格.