BillingHelper
public
final
class
BillingHelper
extends Object
java.lang.Object | |
↳ | com.android.billingclient.util.BillingHelper |
Helper methods for billing client.
Summary
Constants | |
---|---|
String |
DEBUG_MESSAGE
|
String |
EXTRA_PARAMS_DEVELOPER_PAYLOAD
|
String |
EXTRA_PARAMS_ENABLE_PENDING_PURCHASES
|
String |
EXTRA_PARAM_KEY_SKU_DETAILS_TOKEN
|
String |
EXTRA_PARAM_KEY_SUBS_PRICE_CHANGE
|
String |
INAPP_CONTINUATION_TOKEN
|
String |
LIBRARY_VERSION_KEY
Field's key to hold library version key constant. |
String |
RESPONSE_BUY_INTENT_KEY
Key in the response bundle of getBuyIntent for the purchase intent |
String |
RESPONSE_CODE
|
String |
RESPONSE_GET_SKU_DETAILS_LIST
|
String |
RESPONSE_INAPP_ITEM_LIST
|
String |
RESPONSE_INAPP_PURCHASE_DATA_LIST
|
String |
RESPONSE_INAPP_SIGNATURE_LIST
|
String |
RESPONSE_SUBS_MANAGEMENT_INTENT_KEY
Key in the response bundle of getSubsManagement for the subs management intent |
Fields | |
---|---|
public
static
final
String |
LIBRARY_VERSION
Version Name of the current library. |
public
static
int |
NUMBER_OF_CORES
Total number of cores of current device |
Public constructors | |
---|---|
BillingHelper()
|
Public methods | |
---|---|
static
Bundle
|
constructExtraParamsForAcknowledgePurchase(AcknowledgePurchaseParams acknowledgePurchaseParams)
Constructs bundle to provide extra params to |
static
Bundle
|
constructExtraParamsForConsume(ConsumeParams consumeParams, boolean isIabV9Supported)
Constructs bundle to provide extra params to |
static
Bundle
|
constructExtraParamsForGetSkuDetails(boolean isIabV9Supported, boolean enablePendingPurchases)
Constructs bundle to provide extra params to |
static
Bundle
|
constructExtraParamsForLaunchBillingFlow(BillingFlowParams params, boolean isIabV9Supported, boolean enablePendingPurchases)
Constructs bundle to provide extra params to |
static
Bundle
|
constructExtraParamsForQueryPurchases(boolean isIabV9Supported, boolean enablePendingPurchases)
Constructs bundle to provide extra params to |
static
List<Purchase>
|
extractPurchases(Bundle bundle)
Gets a purchase data and signature (or lists of them) from the Bundle and returns the
constructed list of |
static
BillingResult
|
getBillingResultFromIntent(Intent intent, String tag)
Retrieves billingResult from the intent |
static
String
|
getDebugMessageFromBundle(Bundle bundle, String tag)
Retrieves a response code from the bundle |
static
int
|
getResponseCodeFromBundle(Bundle bundle, String tag)
Retrieves a response code from the bundle |
static
int
|
getResponseCodeFromIntent(Intent intent, String tag)
Retrieves a response code from the intent |
static
void
|
logVerbose(String tag, String msg)
Logs a verbose message |
static
void
|
logWarn(String tag, String msg)
Logs a warning message |
Inherited methods | |
---|---|
![]()
java.lang.Object
|
Constants
DEBUG_MESSAGE
String DEBUG_MESSAGE
Constant Value: "DEBUG_MESSAGE"
EXTRA_PARAMS_DEVELOPER_PAYLOAD
String EXTRA_PARAMS_DEVELOPER_PAYLOAD
Constant Value: "developerPayload"
EXTRA_PARAMS_ENABLE_PENDING_PURCHASES
String EXTRA_PARAMS_ENABLE_PENDING_PURCHASES
Constant Value: "enablePendingPurchases"
EXTRA_PARAM_KEY_SKU_DETAILS_TOKEN
String EXTRA_PARAM_KEY_SKU_DETAILS_TOKEN
Constant Value: "skuDetailsToken"
EXTRA_PARAM_KEY_SUBS_PRICE_CHANGE
String EXTRA_PARAM_KEY_SUBS_PRICE_CHANGE
Constant Value: "subs_price_change"
INAPP_CONTINUATION_TOKEN
String INAPP_CONTINUATION_TOKEN
Constant Value: "INAPP_CONTINUATION_TOKEN"
LIBRARY_VERSION_KEY
String LIBRARY_VERSION_KEY
Field's key to hold library version key constant.
Constant Value: "playBillingLibraryVersion"
RESPONSE_BUY_INTENT_KEY
String RESPONSE_BUY_INTENT_KEY
Key in the response bundle of getBuyIntent for the purchase intent
Constant Value: "BUY_INTENT"
RESPONSE_CODE
String RESPONSE_CODE
Constant Value: "RESPONSE_CODE"
RESPONSE_GET_SKU_DETAILS_LIST
String RESPONSE_GET_SKU_DETAILS_LIST
Constant Value: "DETAILS_LIST"
RESPONSE_INAPP_ITEM_LIST
String RESPONSE_INAPP_ITEM_LIST
Constant Value: "INAPP_PURCHASE_ITEM_LIST"
RESPONSE_INAPP_PURCHASE_DATA_LIST
String RESPONSE_INAPP_PURCHASE_DATA_LIST
Constant Value: "INAPP_PURCHASE_DATA_LIST"
RESPONSE_INAPP_SIGNATURE_LIST
String RESPONSE_INAPP_SIGNATURE_LIST
Constant Value: "INAPP_DATA_SIGNATURE_LIST"
RESPONSE_SUBS_MANAGEMENT_INTENT_KEY
String RESPONSE_SUBS_MANAGEMENT_INTENT_KEY
Key in the response bundle of getSubsManagement for the subs management intent
Constant Value: "SUBS_MANAGEMENT_INTENT"
Fields
LIBRARY_VERSION
String LIBRARY_VERSION
Version Name of the current library.
NUMBER_OF_CORES
int NUMBER_OF_CORES
Total number of cores of current device
Public constructors
BillingHelper
BillingHelper ()
Public methods
constructExtraParamsForAcknowledgePurchase
Bundle constructExtraParamsForAcknowledgePurchase (AcknowledgePurchaseParams acknowledgePurchaseParams)
Constructs bundle to provide extra params to acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener)
Parameters | |
---|---|
acknowledgePurchaseParams |
AcknowledgePurchaseParams : params to initiate acknowledge purchase action. |
Returns | |
---|---|
Bundle |
extraParams bundle. |
constructExtraParamsForConsume
Bundle constructExtraParamsForConsume (ConsumeParams consumeParams, boolean isIabV9Supported)
Constructs bundle to provide extra params to consumeAsync(ConsumeParams, ConsumeResponseListener)
Parameters | |
---|---|
consumeParams |
ConsumeParams : params to consume purchase |
isIabV9Supported |
boolean : whether InAppBilling version 9 is supported by Play Store. |
Returns | |
---|---|
Bundle |
extraParams bundle. |
constructExtraParamsForGetSkuDetails
Bundle constructExtraParamsForGetSkuDetails (boolean isIabV9Supported, boolean enablePendingPurchases)
Constructs bundle to provide extra params to querySkuDetailsAsync(SkuDetailsParams, SkuDetailsResponseListener)
Parameters | |
---|---|
isIabV9Supported |
boolean : whether InAppBilling version 9 is supported by Play Store. |
enablePendingPurchases |
boolean : whether to enable pending purchases in purchase flow. |
Returns | |
---|---|
Bundle |
extraParams bundle. |
constructExtraParamsForLaunchBillingFlow
Bundle constructExtraParamsForLaunchBillingFlow (BillingFlowParams params, boolean isIabV9Supported, boolean enablePendingPurchases)
Constructs bundle to provide extra params to launchBillingFlow(Activity, BillingFlowParams)
}
Parameters | |
---|---|
params |
BillingFlowParams : params to initiate a purchase flow. |
isIabV9Supported |
boolean : whether InAppBilling version 9 is supported by Play Store. |
enablePendingPurchases |
boolean : whether to enable pending purchase in purchase flow. |
Returns | |
---|---|
Bundle |
extraParams bundle. |
constructExtraParamsForQueryPurchases
Bundle constructExtraParamsForQueryPurchases (boolean isIabV9Supported, boolean enablePendingPurchases)
Constructs bundle to provide extra params to queryPurchaseHistoryAsync(String, PurchaseHistoryResponseListener)
and queryPurchases(String)
Parameters | |
---|---|
isIabV9Supported |
boolean : whether InAppBilling version 9 is supported by Play Store. |
enablePendingPurchases |
boolean : whether to receive pending purchases in result. |
Returns | |
---|---|
Bundle |
extraParams bundle. |
extractPurchases
List<Purchase> extractPurchases (Bundle bundle)
Gets a purchase data and signature (or lists of them) from the Bundle and returns the
constructed list of Purchase
Parameters | |
---|---|
bundle |
Bundle : The bundle to parse |
Returns | |
---|---|
List<Purchase> |
New Purchase instance with the data extracted from the provided intent |
getBillingResultFromIntent
BillingResult getBillingResultFromIntent (Intent intent, String tag)
Retrieves billingResult from the intent
Parameters | |
---|---|
intent |
Intent |
tag |
String |
Returns | |
---|---|
BillingResult |
getDebugMessageFromBundle
String getDebugMessageFromBundle (Bundle bundle, String tag)
Retrieves a response code from the bundle
Parameters | |
---|---|
bundle |
Bundle |
tag |
String |
Returns | |
---|---|
String |
getResponseCodeFromBundle
int getResponseCodeFromBundle (Bundle bundle, String tag)
Retrieves a response code from the bundle
Parameters | |
---|---|
bundle |
Bundle |
tag |
String |
Returns | |
---|---|
int |
getResponseCodeFromIntent
int getResponseCodeFromIntent (Intent intent, String tag)
Retrieves a response code from the intent
Parameters | |
---|---|
intent |
Intent |
tag |
String |
Returns | |
---|---|
int |
logVerbose
void logVerbose (String tag, String msg)
Logs a verbose message
Parameters | |
---|---|
tag |
String : Tag to be used inside logging |
msg |
String : Message to log
|
logWarn
void logWarn (String tag, String msg)
Logs a warning message
Parameters | |
---|---|
tag |
String : Tag to be used inside logging |
msg |
String : Message to log
|
Classes