LiStore Reference


Package: com.applicasa.ApplicasaManager
Declared In: com.applicasa.ApplicasaManager.LiStore

Overview


Applicasa's LiStore class is intended to provide a high-level API that makes working with in-app purchases much easier on developers. It offers developers the ability to handle buying, giving, and using all VirtualCurrency and VirtualGood items in their apps. In addition, LiStore also provides convenient query methods developers can use to easily fetch items they want to display to users in their in-app virtual stores.

Applicasa's In-App Purchase support is based on the common practice of building virtual stores in which users purchase in-app currency with real money, then use that virtual currency to purchase virtual goods within an app.

VirtualCurrency and VirtualGood items are managed via Applicasa's developer web console, which currently supports offering primary and secondary VirtualCurrency types, as well as unlimited categories of VirtualGood items.


Tasks


Handling Virtual Currencies

buyVirtualCurrency(Activity, VirtualCurrency, LiCallbackIAPPurchase)
giveVirtualCurrency(int, LiCurrency, LiCallbackVirtualCurrencyRequest)
useVirtualCurrency(int, LiCurrency, LiCallbackVirtualCurrencyRequest)
getAllVirtualCurrency
getAllVirtualCurrencyByKind(LiCurrency)

Handling Virtual Goods

buyVirtualGoods(VirtualGood, int, LiCurrency, LiCallbackVirtualGoodRequest)
giveVirtualGoods(VirtualGood, int, LiCallbackVirtualGoodRequest)
useVirtualGoods(VirtualGood, int, LiCallbackVirtualGoodRequest)
getAllVirtualGoods(GetVirtualGoodKind)
getAllVirtualGoodsCategory
getVirtualGoodByCategory(VirtualGoodCategory, GetVirtualGoodKind)

User Balances

getUserCurrencyBalance(LiCurrency)

Refreshing Data

refreshInventory
refreshStore
reloadIAPLocally
reloadVirtualGoodInventory


Class Methods


buyVirtualCurrency(Activity, VirtualCurrency, LiCallbackIAPPurchase)

Instructs Applicasa to purchase a given VirtualCurrency item selected by the user.

public static boolean buyVirtualCurrency(Activity activity, VirtualCurrency virtualCurrency, LiCallbackIAPPurchase liCallbackIAPPurchase)

Parameters:

activity
The Activity object presented to the user.

virtualCurrency
The VirtualCurrency item the user wishes to purchase.

liCallbackIAPPurchase
An LiCallbackIAPPurchase implementation that developers can optionally implement to provide customized handling of failure conditions.

Return Value:

A boolean indicating success or failure of the request.

Discussion:

This method is intended for all real-money purchases a developer may wish to perform on behalf of users, providing a user with the amount of virtualCurrency value in return. Developers may respond to method completion to handle success and failure by implementing the liCallbackIAPPurchase interface, or by responding to the boolean return value.

buyVirtualGoods(VirtualGood, int, LiCurrency, LiCallbackVirtualGoodRequest)

Instructs Applicasa to purchase a given VirtualGood item selected by the user, in specific quantity, and using the provided currency.

public static boolean buyVirtualGoods(VirtualGood virtualGood, int quantity, LiCurrency currency, LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

virtualGood
The VirtualGood item the user wishes to purchase.

quantity
The desired quantity of items to purchase.

currency
An LiCurrency enum value indicating which kind of VirtualCurrency to use for the transaction. Currently allowed values are MainCurrency and SecondaryCurrency.

liCallbackVirtualGoodRequest
An LiCallbackVirtualGoodRequest implementation that developers can optionally implement to provide customized handling of failure conditions.

Return Value:

A boolean indicating success or failure of the request.

Discussion:

This method is intended for all VirtualGood purchases a developer may wish to perform on behalf of users, providing them with the provided virtualGood item(s) in return. Developers may respond to method completion to handle success and failure by implementing the LiCallbackVirtualGoodRequest interface, or by responding to the boolean return value.

Developers are offered the ability to choose which type of currency to use via the currency parameter. Currently supported choices are MainCurrency and SecondaryCurrency.

giveVirtualCurrency(int, LiCurrency, LiCallbackVirtualCurrencyRequest)

Instructs Applicasa to give VirtualCurrency of a specified type and amount to the user.

public static boolean giveVirtualCurrency(int amount, LiCurrency currency, LiCallbackVirtualCurrencyRequest liCallbackVirtualCurrencyRequest)

Parameters:

amount
An integer indicating the amount of currency to give the user.

currency
An LiCurrency enum value indicating which kind of VirtualCurrency to use for the transaction. Currently allowed values are MainCurrency and SecondaryCurrency.

liCallbackVirtualCurrencyRequest
An LiCallbackVirtualCurrencyRequest implementation that developers can optionally implement to provide customized handling of failure conditions.

Return Value:

A boolean indicating success or failure of the request.

Discussion:

This method allows developers the flexibility to give VirtualCurrency of a specified type and amount to the user based on criteria of their choosing within their apps. Developers may respond to method completion to handle success and failure by implementing the LiCallbackVirtualCurrencyRequest interface, or by responding to the boolean return value.

Developers are offered the ability to choose which type of currency to use via the currency parameter. Currently supported choices are MainCurrency and SecondaryCurrency.

giveVirtualGoods(VirtualGood, int, LiCallbackVirtualGoodRequest)

Instructs Applicasa to give a VirtualGood item to the user, in specific quantity.

public static boolean giveVirtualGoods(VirtualGood virtualGood, int quantity, LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

virtualGood
The VirtualGood item the developer wishes to give to a user.

quantity
The desired quantity of items to give the user.

liCallbackVirtualGoodRequest
An LiCallbackVirtualGoodRequest implementation that developers can optionally implement to provide customized handling of failure conditions.

Return Value:

A boolean indicating success or failure of the request.

Discussion:

This method is intended for all VirtualGood gifts and rewards for users, providing them with the virtualGood item(s) in return. Developers may respond to method completion to handle success and failure by implementing the LiCallbackVirtualGoodRequest interface, or by responding to the boolean return value.

useVirtualCurrency(int, LiCurrency, LiCallbackVirtualCurrencyRequest)

Instructs Applicasa to deduct VirtualCurrency of a specified type and amount from the user.

public static boolean useVirtualCurrency(int amount, LiCurrency currency, LiCallbackVirtualCurrencyRequest liCallbackVirtualCurrencyRequest)

Parameters:

amount
An integer indicating the amount of currency to deduct from the user.

currency
An LiCurrency enum value indicating which kind of VirtualCurrency to use for the transaction. Currently allowed values are MainCurrency and SecondaryCurrency.

liCallbackVirtualCurrencyRequest
An LiCallbackVirtualCurrencyRequest implementation that developers can optionally implement to provide customized handling of failure conditions.

Return Value:

A boolean indicating success or failure of the request.

Discussion:

This method allows developers the flexibility to deduct VirtualCurrency of a specified type and amount from the user based on criteria of their choosing within their apps. Developers may respond to method completion to handle success and failure by implementing the LiCallbackVirtualCurrencyRequest interface, or by responding to the boolean return value.

Developers are offered the ability to choose which type of currency to use via the currency parameter. Currently supported choices are MainCurrency and SecondaryCurrency.

useVirtualGoods(VirtualGood, int, LiCallbackVirtualGoodRequest)

Instructs Applicasa to consume a VirtualGood item from the user's inventory, in specific quantity.

public static boolean useVirtualGoods(VirtualGood virtualGood, int quantity, LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

virtualGood
The VirtualGood item the user wishes to consume from their inventory.

quantity
The desired quantity of items to deduct from the user's inventory.

liCallbackVirtualGoodRequest
An LiCallbackVirtualGoodRequest implementation that developers can optionally implement to provide customized handling of failure conditions.

Return Value:

A boolean indicating success or failure of the request.

Discussion:

This method is intended for all VirtualGood consumption, providing developers the convenience of deducting virtualGood item(s) from a user's inventory. Developers may respond to method completion to handle success and failure by implementing the LiCallbackVirtualGoodRequest interface, or by responding to the boolean return value.

getAllVirtualCurrency

Instructs Applicasa to query for all available VirtualCurrency items.

public static List<VirtualCurrency> getAllVirtualCurrency()

Return Value:

A List of all VirtualCurrency items.

Discussion:

This method provides developers a convenient way to quickly fetch all available VirtualCurrency items.

getAllVirtualCurrencyByKind(LiCurrency)

Instructs Applicasa to query for all available VirtualCurrency items.

public static List<VirtualCurrency> getAllVirtualCurrencyByKind(LiCurrency currency)

Parameters:

currency
An LiCurrency enum value indicating which kind of VirtualCurrency to use for the transaction. Currently allowed values are MainCurrency and SecondaryCurrency.

Return Value:

A List of all VirtualCurrency items of the specified LiCurrency kind.

Discussion:

This method provides developers a convenient way to quickly fetch all available VirtualCurrency items of a specified LiCurrency kind.

getAllVirtualGoods(GetVirtualGoodKind)

Instructs Applicasa to query for all available VirtualGood items of the specified GetVirtualGoodKind.

public static List<VirtualGood> getAllVirtualGoods(GetVirtualGoodKind getVirtualGoodKind)

Parameters:

getVirtualGoodKind
A GetVirtualGoodKind enum value indicating which kind of VirtualGood to use for the query. Current allowed values are ALL, NoInventory, and HasInventory.

Return Value:

A List of VirtualGood items that match the specificed GetVirtualGoodKind.

Discussion:

This method provides developers a convenient way to quickly fetch all available VirtualGood items by specified GetVirtualGoodKind. The GetVirtualGoodKind enum currently provides three available types—all virtual goods (ALL), only items in a user's inventory (HasInventory), and only items a user does not have in his or her inventory (NoInventory).

getAllVirtualGoodsCategory

Instructs Applicasa to query for all available VirtualGoodCategory items.

public static List<VirtualGoodCategory> getAllVirtualGoodsCategory()

Return Value:

A List of all available VirtualGoodCategory items.

Discussion:

This method provides developers a convenient way to quickly fetch all available VirtualGoodCategory items that are used for organizing VirtualGood items.

getVirtualGoodByCategory(VirtualGoodCategory, GetVirtualGoodKind)

Instructs Applicasa to query for all available VirtualGood items of the specified GetVirtualGoodKind and VirtualGoodCategory.

public static List<VirtualGood> getVirtualGoodByCategory(VirtualGoodCategory virtualGoodCategory, GetVirtualGoodKind getVirtualGoodKind)

Parameters:

virtualGoodCategory
A VirtualGoodCategory instance indicating which category of VirtualGood to use for the query.

getVirtualGoodKind
A GetVirtualGoodKind enum value indicating which kind of VirtualGood to use for the query. Current allowed values are ALL, NoInventory, and HasInventory.

Return Value:

A List of VirtualGood items that match the specified VirtualGoodCategory and GetVirtualGoodKind.

Discussion:

This method provides developers a convenient way to quickly fetch all available VirtualGood items by specified GetVirtualGoodKind and VirtualGoodCategory. The GetVirtualGoodKind enum currently provides three available types—all virtual goods (ALL), only items in a user's inventory (HasInventory), and only items a user does not have in his or her inventory (NoInventory). The available VirtualGoodCategory items are dependent entirely on how a developer chooses to categorize VirtualGood items in the Applicasa developer web console.

getUserCurrencyBalance(LiCurrency)

Instructs Applicasa to return the user's current balance of a specified LiCurrency kind.

public static int getUserCurrencyBalance(LiCurrency currency)

Parameters:

currency
An LiCurrency enum value indicating which kind of VirtualCurrency to use for the transaction. Currently allowed values are MainCurrency and SecondaryCurrency.

Return Value:

An integer value indicating the specified LiCurrency balance.

Discussion:

Provides a convenient way to get a user's current balance of a specified LiCurrency kind.

refreshInventory

Retrieves a user's inventory from Applicasa's service.

public static void refreshInventory()

Discussion:

Makes a remote call to fetch the latest user inventory data from the Applicasa service. This can be used any time a developer wants to ensure local inventory data is up-to-date.

refreshStore

Retrieves the entire virtual store from Applicasa's service.

public static void refreshStore()

Discussion:

Makes a remote call to fetch the latest store data from the Applicasa service. This can be used any time a developer wants to ensure local store data is up-to-date.

WARNING: The larger a virtual store is, the more time this method can take to complete. In most cases, developers should not have to call this method during normal course of app operation.

reloadIAPLocally

Reloads local IAP data.

public static void reloadIAPLocally()

reloadVirtualGoodInventory

Reloads user inventory from local database.

public static void reloadVirtualGoodInventory()


  « Back to SDK Class List