class RInAppBilling
interface OnInAppBillingCallback |
|
interface OnInAppConsumeCallback |
|
object Security
Security-related methods. For a secure implementation, all of this code should be implemented on a server that communicates with the application on the device. For the sake of simplicity and clarity of this example, this code is included here and is executed on the device. If you must verify the purchases on the phone, you should obfuscate this code to make it harder for an attacker to replace the code with stubs that treat all purchases as verified. |
RInAppBilling(activity: Activity, signatureBase64: String) |
fun bindInAppBilling(): Unit
Should be initialized in onCreate |
|
fun consumePurchase(transaction: Transaction?): Unit
Consume specific item which consumable item |
|
fun generateDeveloperPayload(productId: String, type: String): String
generate developerPayload using nonce(UUID) |
|
fun getAvailableInappPackage(items: ArrayList<String>): ArrayList<Sku>
get Available 'inapp' package of own package name. |
|
fun isValidTransaction(transaction: Transaction): Boolean
Checking transaction is valid. |
|
fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Unit
Purchase Result billingCallback, just pass Activity's onActivityResult. |
|
fun purchase(productId: String, type: String = "inapp", developerPayload: String = generateDeveloperPayload(productId, type)): Unit
Purchase specific item |
|
fun setOnInAppBillingCallback(callback: (Int, Transaction?) -> Unit): Unit
Using when try to purchase un-consumable item |
|
fun setOnInAppConsumeCallback(callback: (Int, Transaction?) -> Unit): Unit
Using when try to purchase consumable item, within using AppBillingUtils.setOnInAppBillingCallback(OnInAppBillingCallback) |
|
fun unBindInAppBilling(): Unit
Should be initialized in onDestroy |
val PURCHASE_FAILED_INVALID: Int |
|
val PURCHASE_FAILED_UNKNOWN: Int |
|
val PURCHASE_SUCCESS: Int |