VirtualCurrency Reference
Extends: VirtualCurrencyData
Package: com.applicasa.VirtualCurrency
Declared In: com.applicasa.VirtualCurrency.VirtualCurrency
Overview
Applicasa's VirtualCurrency class offers developers a powerful basis for building their application's virtual store. Out of the box, Applicasa supports two types of VirtualCurrency developers can use right away—MainCurrency and SecondaryCurrency. Developers can use both kinds in whatever ways they wish, and tie both to actual In-App Purchase items users buy from the iOS and Android app stores.
The intention behind VirtualCurrency usage is that each item you offer to your users is purchased via Applicasa's IAP class API, which handles all the hard work of making real-money purchases on behalf of your users. Then, in-game currency is used when a user wishes to purchase VirtualGood items. While you can use the VirtualCurrency class directly, most typical interactions can be handled via the IAP class API.
VirtualCurrency items are managed exclusively from the Applicasa developer web portal.
Tasks
Querying Virtual Currencies
getAllVirtualCurrency
getAllVirtualCurrencyByKind(LiCurrency)
Virtual Currency Transactions
buyVirtualCurrency(Activity, LiCallbackIAPPurchase)
giveVirtualCurrency(int, LiCurrency, LiCallbackVirtualCurrencyRequest)
useVirtualCurrency(int, LiCurrency, LiCallbackVirtualCurrencyRequest)
Properties
VirtualCurrencyID
The item's unique ID value.
public String VirtualCurrencyID;
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 VirtualCurrency item via the Applicasa developer's web console. This property is not editable.
VirtualCurrencyTitle
The item's display title.
public String VirtualCurrencyTitle;
Discussion:
A String value for the currency 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.
VirtualCurrencyAppleIdentifier
The item's unique Apple product identifier, if listed for sale to iOS devices.
public String VirtualCurrencyAppleIdentifier;
Discussion:
This property is editable from the web console.
VirtualCurrencyGoogleIdentifier
The item's unique Google product identifier, if listed for sale to Android devices.
public String VirtualCurrencyGoogleIdentifier;
Discussion:
This property is editable from the web console.
VirtualCurrencyDescription
The item's description.
public String VirtualCurrencyDescription;
Discussion:
This property is editable from the web console.
VirtualCurrencyPrice
An float value indicating the item's sale price.
public float VirtualCurrencyPrice;
Discussion:
This property is editable from the web console.
VirtualCurrencyCredit
An int value indicating how much currency credit a user receives after purchasing this item.
public int VirtualCurrencyCredit;
Discussion:
This property is editable from the web console.
VirtualCurrencyKind
An int value indicating whether this item is of primary or secondary currency type.
public int VirtualCurrencyKind;
Discussion:
This property is editable from the web console.
VirtualCurrencyImageA
A String indicating the item's main image location.
public String VirtualCurrencyImageA;
Discussion:
This property is automatically generated and updated from the web console.
VirtualCurrencyImageB
A String indicating the item's secondary image location.
public String VirtualCurrencyImageB;
Discussion:
This property is automatically generated and updated from the web console.
VirtualCurrencyImageC
A String indicating the item's tertiary image location.
public String VirtualCurrencyImageC;
Discussion:
This property is automatically generated and updated from the web console.
VirtualCurrencyIsDeal
A Boolean value indicating if the item is a special deal.
public Boolean VirtualCurrencyIsDeal;
Discussion:
This property is editable from the web console.
VirtualCurrencyInAppleStore
A Boolean value indicating if the item is available to iOS devices.
public Boolean VirtualCurrencyInAppleStore;
Discussion:
This property is editable from the web console.
VirtualCurrencyInGoogleStore
A Boolean value indicating if the item is available to Android devices.
public Boolean VirtualCurrencyInGoogleStore;
Discussion:
This property is editable from the web console.
VirtualCurrencyLastUpdate
A datetime value of the last time the item was updated from the web console.
public GregorianCalendar VirtualCurrencyLastUpdate;
Discussion:
This property is automatically generated and updated from the web console.
Class Methods
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.
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 licurrency, LiCallbackVirtualCurrencyRequest liCallbackVirtualCurrencyRequest)
Parameters:
amount
An integer indicating the amount of currency to give the user.
licurrency
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.
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 licurrency, LiCallbackVirtualCurrencyRequest liCallbackVirtualCurrencyRequest)
Parameters:
amount
An integer indicating the amount of currency to deduct from the user.
licurrency
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.
Instance Methods
buyVirtualCurrency(Activity, LiCallbackIAPPurchase)
Instructs Applicasa to purchase a given VirtualCurrency item selected by the user.
public boolean buyVirtualCurrency(Activity activity, VirtualCurrency virtualCurrency, LiCallbackIAPPurchase liCallbackIAPPurchase)
Parameters:
activity
The Activity object presented to the user.
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.