class RInAppBilling
interface ConsumePurchaseResult |
|
interface PurchaseResult |
|
interface QueryPurchaseResult |
|
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 invoke in onCreate |
|
fun consumePurchase(transaction: Transaction?, callback: ConsumePurchaseResult): 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 getPurchase(type: String = "inapp", continuationToken: String? = null, callback: QueryPurchaseResult): Unit
query purchased item which not consumed |
|
fun isValidTransaction(transaction: Transaction): Boolean
Checking transaction is valid. |
|
fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Unit
Purchase Result purchaseResult, just pass Activity's onActivityResult. |
|
fun purchase(productId: String, type: String = "inapp", developerPayload: String = generateDeveloperPayload(productId, type)): Unit
Purchase specific item |
|
fun setPurchaseResult(callback: PurchaseResult): Unit
Using when try to purchase un-consumable item |
|
fun unBindInAppBilling(): Unit
Should be invoke in onDestroy |
val PURCHASE_FAILED_INVALID: Int |
|
val PURCHASE_FAILED_TO_GET_EMPTY: Int |
|
val PURCHASE_FAILED_UNKNOWN: Int |
|
val PURCHASE_SUCCESS: Int |