Artenus 2D Framework
Artenus Reference
Superclass for all in-app billing managers. A unified services implementation should return an instance of this class if it handles in-app products and subscriptions.
public abstract class InventoryManager

Constructor Summary

Modifier and TypeConstructor and Description
protected InventoryManager()
Creates an empty instance of InventoryManager.

Method Summary

Modifier and TypeMethod and Description
public abstract voidconsume(ProductReceipt receipt)
Consumes a previously purchased product.
protected final InventoryListenergetListener()
Gets the current inventory listener responsible for this instance.
protected final StringgetSKUs()
Gets the list of SKUs currently handled by this instance.
public abstract booleanisBillingSupported()
Determines whether the store supports in-app billing.
public abstract booleanonActivityResult(int requestCode, int resultCode, Intent data)
Called internally by onActivityResult(int, int, Intent) to handle activity results for in-app billing.
public abstract voidonCreate(Context context)
Called internally as part of onCreate(Context).
public abstract voidonDestroy(Context context)
Called internally as part of onCreate(Context).
public abstract voidpurchase(String sku)
Launches a purchase flow for the specified product.
public final voidsetListener(InventoryListener listener)
Appoints a new listener to handle in-app billing events for this instance.
public final voidsetSKUs(String[] inventorySKUs)
Sets the list of SKUs of interest.
public abstract voidsubscribe(String sku)
Launches a subscription flow for the specified subscription SKU.

Methods inherited from java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

InventoryManager
protected  InventoryManager()
Creates an empty instance of InventoryManager.

Method Detail

consume
public abstract void consume(
    ProductReceipt receipt
)
Consumes a previously purchased product.
Parameters:
receiptThe receipt corresponding to the purchased product
See Also:
getListener
protected final InventoryListener getListener()
Gets the current inventory listener responsible for this instance.
Returns:
Current inventory listener, or null if non-existent
getSKUs
protected final String getSKUs()
Gets the list of SKUs currently handled by this instance.
Returns:
List of product SKUs
isBillingSupported
public abstract boolean isBillingSupported()
Determines whether the store supports in-app billing.
Returns:
true if in-app billing is supported, false otherwise
onActivityResult
public abstract boolean onActivityResult(
    int requestCode,
    int resultCode,
    Intent data
)
Called internally by onActivityResult(int, int, Intent) to handle activity results for in-app billing.
Parameters:
requestCodeThe integer request code
resultCodeThe integer result code returned by the child activity
dataAn Intent, which can return result data to the caller
Returns:
true if handled by inventory manager, false otherwise
onCreate
public abstract void onCreate(
    Context context
)
Called internally as part of onCreate(Context).
Parameters:
contextArtenus context
onDestroy
public abstract void onDestroy(
    Context context
)
Called internally as part of onCreate(Context).
Parameters:
contextArtenus context
purchase
public abstract void purchase(
    String sku
)
Launches a purchase flow for the specified product. The result will be reported to the inventory listener associated with this instance.
Parameters:
skuProduct SKU
See Also:
setListener
public final void setListener(
    InventoryListener listener
)
Appoints a new listener to handle in-app billing events for this instance.
Parameters:
listenerThe new inventory listener, or null to remove the listener
setSKUs
public final void setSKUs(
    String[] inventorySKUs
)
Sets the list of SKUs of interest. In order for the system to load SKUs at startup, they should all be included for this call.
Parameters:
inventorySKUsList of product SKUs
subscribe
public abstract void subscribe(
    String sku
)
Launches a subscription flow for the specified subscription SKU.
Parameters:
skuProduct SKU corresponding to the desired subscription