gpt4 book ai didi

android - 当文档如此不一致时,我们如何实现应用内购买?

转载 作者:太空狗 更新时间:2023-10-29 14:42:57 24 4
gpt4 key购买 nike

当涉及到您应该如何处理应用内结算时,官方文档非常不清楚。

对于初学者来说,TrivialDrive 有两个版本:

github.com/googlesamples/android-play-billing

然后来自官方文档:

developer.android.com/google/play/billing/billing_integrate.html

(此处表示导入 IInAppBillingService.aidl 文件并使用 ServiceConnections/IInAppBillingService)

developer.android.com/training/play-billing-library/preparing-iab-app.html

(这里说要查看 Trivial Drive v2,并且还使用 compile 'com.android.billingclient:billing:dp-1' 而不是导入 .aidl 文件,并使用 BillingManager)

developer.android.com/training/in-app-billing/preparing-iab-app.html

(这里说要查看 Trivial Drive,导入 .aidl 文件,然后使用 IabHelper + 关联的监听器代替所有内容)

谁能解释一下为什么 Android 平台如此重要的部分对所有地方的事物都有不同的解释?我们需要使用的预期/最新框架是什么?哪些作品过时了?我应该引用哪个 TrivialDrive?

最佳答案

In-app Billing Version Notes 中所述, In-app Billing API 是版本化的,每个版本都为您的应用程序提供额外的功能。有了这个,您可能需要先检查您的应用内结算版本。

At run time, your app can query the Google Play Store app to determine what version of the API it supports and what features are available.

  • If you are using in-app billing version 3 or later, the version information is not directly returned by Google Play. Instead, you can check if Google Play supports the version of the In-app Billing API that you are using by sending an isBillingSupported request.
  • If the In-app Billing API version that you are using is earlier than version 3, the version information is returned in the API_VERSION key of the Bundle object passed in the sendBillingRequest method. For more information, see In-app Billing Service Interface.

如果您使用的是应用内结算第 3 版 API,请使用此 TrivialDrive对于版本 3 API,如 In-app Billing Overview 中所述.否则,请参阅 migration considerations其中指出,

The In-app Billing Version 2 API was discontinued in January 2015. If you have an existing In-app Billing implementation that uses API Version 2 or earlier, you must migrate to In-app Billing Version 3.

最后,这个 documentationPlay Billing Library 的预览版.对于应用内结算版本 3 API,您可能希望将其用作 reference相反。

希望这有助于解决问题。

关于android - 当文档如此不一致时,我们如何实现应用内购买?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44911596/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com