如何实现 google play billing library version 4?

问题描述

我是 Android 新手,我想添加应用内购买以移除应用中的广告。我试图阅读documentation,但对我来说这一切都非常令人困惑。 到目前为止我所做的是:

  1. 在 Play 控制台上创建了一个应用并发布以供内部测试
  2. 创建商家帐户并添加应用内购买产品以移除广告。

有人可以提供一些关于如何在我的应用程序中集成计费方法的教程,并简要解释上面链接中的代码的作用吗? 我是否必须在 Play 控制台上启用开发者 API 才能用于应用结算?

解决方法

我为 Google Play 应用内结算版本 4 找到了一个简单的库

https://github.com/akshaaatt/Google-IAP

使用方法:

val iapConnector = IapConnector(
            context = this,// activity / context
            nonConsumableKeys = listOf(),// pass the list of non-consumables
            consumableKeys = listOf(),// pass the list of consumables
            subscriptionKeys = listOf(),// pass the list of subscriptions
            key = "LICENSE KEY" // pass your app's license key
            enableLogging = true // to enable / disable logging
        )

如果您有任何问题,请告诉我