项目
在 GitHub 查看
akshaaatt/Google-IAP
关于
Android Library for easing Google Play Billing to your apps with support for Subscriptions, Non-Consumable and Consumable Purchases with a beautiful sample app.
网站与应用开发可以做什么
- Written in Kotlin
- No boilerplate code
- Easy initialization
- Supports InApp & Subscription products
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Google-IAP (Play Billing Library Version 8.0.0)
Features • Development • Usage • License • Contribution
IAP is an Android library to handle In-App purchases with minimal code.
Features
- Written in Kotlin
- No boilerplate code
- Easy initialization
- Supports InApp & Subscription products
- Simple configuration for consumable products
Gradle Dependency
- Add the JitPack repository to your project's build.gradle file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency in your app's build.gradle file
dependencies {
implementation 'com.github.akshaaatt:Google-IAP:1.8.0'
}
Development
- Prerequisite: Latest version of the Android Studio and SDKs on your pc.
- Clone this repository.
- Use the
gradlew buildcommand to build the project directly or use the IDE to run the project to your phone or the emulator.
Usage
Establishing connection with Play console
val iapConnector = IapConnector(
context = this, // activity / context
nonConsumableKeys = nonConsumablesList, // pass the list of non-consumables
consumableKeys = consumablesList, // pass the list of consumables
subscriptionKeys = subsList, // pass the list of subscriptions
key = "LICENSE KEY", // pass your app's license key
enableLogging = true // to enable / disable logging
)
Receiving events
iapConnector.addPurchaseListener(object : PurchaseServiceListener {
override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.SkuDetails>) {
// list of available products will be received here, so you can update UI with prices if needed
}
override fun onProductPurchased(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered whenever purchase succeeded
}
override fun onProductRestored(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered fetching owned products using IapConnector
}
})
iapConnector.addSubscriptionListener(object : SubscriptionServiceListener {
override fun onSubscriptionRestored(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered upon fetching owned subscription upon initialization
}
override fun onSubscriptionPurchased(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered whenever subscription succeeded
}
override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.SkuDetails>) {
// list of available products will be received here, so you can update UI with prices if needed
}
})
Making a purchase
iapConnector.purchase(this, "<sku>")
Making a subscription
iapConnector.subscribe(this, "<sku>")
Removing a subscription
iapConnector.unsubscribe(this, "<sku>")
Sample App
Add your products to the developer console
Replace the key with your App's License Key
Apps Using this Library
License
This Project is licensed under the GPL version 3 or later.
Contribution
You are most welcome to contribute to this project!
探索相关项目
加载中…

