VirtualGood Reference


Extends: VirtualGoodData
Package: com.applicasa.VirtualGood
Declared In: com.applicasa.VirtualGOod.VirtualGood

Overview


Applicasa's VirtualGood class provides a great amount of flexibility to offer consumable and non-consumable items to application users. VirtualGood items are offered for sale to users via in-game currency, provided by the VirtualCurrency class. Developers can create any kind of virtual item imaginable, organize them into VirtualGoodCategory groups, and deliver them to users in their own custom UI presentations.

While you can and sometimes will interact with VirtualGood items directly, most typical interactions can be handled via the LiStore class API.

VirtualGood items are managed exclusively from the Applicasa developer web portal.


Tasks


Querying Virtual Goods

getAllVirtualGoods(GetVirtualGoodKind)
getVirtualGoodByCategory(VirtualGoodCategory, GetVirtualGoodKind)
getArrayWithQuery(LiQuery, LiVirtualGoodGetArrayCallback)

Virtual Good Transactions

buyVirtualGoods(int, LiCurrency, LiCallbackVirtualGoodRequest)
buyVirtualGoods(LiCurrency, LiCallbackVirtualGoodRequest)
giveVirtualGoods(int, LiCallbackVirtualGoodRequest)
giveVirtualGoods(LiCallbackVirtualGoodRequest)
useVirtualGoods(int, LiCallbackVirtualGoodRequest)
useVirtualGoods(LiCallbackVirtualGoodRequest)


Properties


VirtualGoodID

The item's unique ID value.

public String VirtualGoodID;

Discussion:

This is the instance's unique ID value as recorded in the Applicasa datastore. It is set by the datastore when you create a new VirtualGood item via the Applicasa developer's web console. This property is not editable.

VirtualGoodTitle

The item's display title.

public String VirtualGoodTitle;

Discussion:

A String value for the item's title. You'd most often use this value to display the item's name within your app. Can be edited from the web console.

VirtualGoodDescription

The item's description.

public String VirtualGoodDescription;

Discussion:

This property is editable from the web console.

VirtualGoodMainCurrency

An int value indicating the item's price in terms of an app's main currency.

public int VirtualGoodMainCurrency;

Discussion:

This property is editable from the web console.

VirtualGoodSecondaryCurrency

An int value indicating the item's price in terms of an app's secondary currency.

public int VirtualGoodSecondaryCurrency;

Discussion:

This property is editable from the web console.

VirtualGoodRelatedVirtualGood

A String indicating a related virtual good tied to this item.

public String VirtualGoodRelatedVirtualGood;

Discussion:

The virtualGoodRelatedVirtualGood property is used in situations where you want to offer a single VirtualGood that represents a collection of other VirtualGood items.

This property is editable from the web console. You'll find this in the Virtual Good edit window, labeled as Add as Pack, where you'll then choose the related virtual item that is part of the pack.

VirtualGoodQuantity

An int value indicating the quantity of related items available with a pack item.

public int VirtualGoodQuantity;

Discussion:

The virtualGoodQuantity property is only used in conjunction with the virtualGoodRelatedVirtualGood property of collection items. This property is editable from the web console. Whenever you create a VirtualGood as a pack of items, you will set the quantity of included items.

VirtualGoodMaxForUser

An int value indicating the maximum number of this kind of item a user is allowed to have in inventory.

public int VirtualGoodMaxForUser;

Discussion:

Allows developers to set managed limits on any virtual items. This property is editable from the web console.

VirtualGoodUserInventory

An int value indicating how many of this item is currently held in a user's inventory.

public int VirtualGoodUserInventory;

Discussion:

This property is not editable directly, but is updated by the Applicasa IAP framework whenever VirtualGood items are bought, given, or used.

VirtualGoodImageA

A String indicating the item's main image location.

public String VirtualCurrencyImageA;

Discussion:

This property is automatically generated and updated from the web console.

VirtualGoodImageB

A String indicating the item's secondary image location.

public String VirtualGoodImageB;

Discussion:

This property is automatically generated and updated from the web console.

VirtualGoodImageC

A String indicating the item's tertiary image location.

public String VirtualGoodImageC;

Discussion:

This property is automatically generated and updated from the web console.

VirtualGoodIsDeal

A Boolean value indicating if the item is a special deal.

public Boolean VirtualGoodIsDeal;

Discussion:

This property is editable from the web console.

VirtualGoodConsumable

A Boolean value indicating if the item is consumable.

public Boolean VirtualGoodConsumable;

Discussion:

This property is used to indicate whether an item is consumable and should be decremented from user inventory whenever the item is used. If NO, then the item is treated as a non-consumable item that will always be in a user's inventory.

VirtualGoodLastUpdate

A datetime value of the last time the item was updated from the web console.

public GregorianCalendar VirtualGoodLastUpdate;

Discussion:

This property is automatically generated and updated from the web console.

VirtualGoodMainCategory

A VirtualGoodCategory instance indicating to which category this item belongs.

public VirtualGoodCategory VirtualGoodMainCategory;

Discussion:

The virtualGoodMainCategory property is set from the web console when managing an item. This property value can be used as an argument to one of the VirtualGood query methods that allow filtering items by category.


Class Methods


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).

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.

getArrayWithQuery(LiQuery, LiVirtualGoodGetArrayCallback)

Retrieve VirtualGood items via an LiQuery-based lookup.

public static void getArrayWithQuery(LiQuery query, LiVirtualGoodGetArrayCallback liVirtualGoodGetArrayCallback)

Parameters:

query
An LiQuery instance describing the query for the objects you wish to retrieve.

liVirtualGoodGetArrayCallback
A LiVirtualGoodGetArrayCallback callback interface implementation that responds to asynchronous requests for VirtualGood items.

Discussion:

This method allows a developer to asynchronously retrieve VirtualGood objects from the Applicasa datastore, indicating what kind of query the developer wishes to perform, and a callback to process and respond to results.


Instance Methods


buyVirtualGoods(int, LiCurrency, LiCallbackVirtualGoodRequest)

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

public boolean buyVirtualGoods(int quantity, LiCurrency licurrency, LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

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 multiple 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.

buyVirtualGoods(LiCurrency, LiCallbackVirtualGoodRequest)

Instructs Applicasa to purchase a given VirtualGood item selected by the user, in single quantities only, and using the provided LiCurrency kind.

public boolean buyVirtualGoods(LiCurrency licurrency, LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

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 single VirtualGood purchases a developer may wish to perform on behalf of users, providing them with the provided virtualGood item 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.

giveVirtualGoods(int, LiCallbackVirtualGoodRequest)

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

public boolean giveVirtualGoods(int quantity, LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

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 multiple 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.

giveVirtualGoods(LiCallbackVirtualGoodRequest)

Instructs Applicasa to give a VirtualGood item to the user in single quantity only.

public boolean giveVirtualGoods(LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

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 single 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.

useVirtualGoods(int, LiCallbackVirtualGoodRequest)

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

public boolean useVirtualGoods(int quantity, LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

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 multiple 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.

useVirtualGoods(LiCallbackVirtualGoodRequest)

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

public boolean useVirtualGoods(LiCallbackVirtualGoodRequest liCallbackVirtualGoodRequest)

Parameters:

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 single 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.


  « Back to SDK Class List