Tapjoy SDK - C++ API
tapjoy::Tapjoy Class Reference

C++ API class of the Tapjoy SDK. More...

#include <TapjoyCpp.h>

Static Public Member Functions

static jint setJavaVM (JavaVM *vm)
 Sets the JavaVM instance to interoperate with Java for Android only. More...
 
static void setContext (jobject context)
 
static const char * getLibraryName ()
 Returns the name of the library linked.
 
static const char * getVersion ()
 Returns the version name of the SDK. More...
 
static void setDebugEnabled (bool enable)
 Enables the debug mode of the SDK. More...
 
static bool connect (jobject context, const char *sdkKey, TJConnectListener *listener=NULL)
 Connects to the Tapjoy Server. More...
 
static bool connect (const char *sdkKey, TJConnectListener *listener=NULL)
 Connects to the Tapjoy Server. More...
 
static void showOffers (TJOffersListener *listener)
 Show available offers to the user. More...
 
static void showOffersWithCurrencyID (const char *currencyID, bool enableCurrencySelector, TJOffersListener *listener)
 Show available offers using a currencyID and currency selector flag. More...
 
static void getCurrencyBalance (TJGetCurrencyBalanceListener *listener)
 Gets the virtual currency data from the server for this device. More...
 
static void spendCurrency (int amount, TJSpendCurrencyListener *listener)
 Spends virtual currency. More...
 
static void awardCurrency (int amount, TJAwardCurrencyListener *listener)
 Awards virtual currency. More...
 
static void setEarnedCurrencyListener (TJEarnedCurrencyListener *listener)
 Sets the listener which gets informed whenever virtual currency is earned. More...
 
static void setCurrencyMultiplier (float multiplier)
 ONLY USE FOR NON-MANAGED (by TAPJOY) CURRENCY. More...
 
static float getCurrencyMultiplier ()
 Gets the multiplier for the virtual currency display. More...
 
static void trackPurchase (const char *productId, const char *currencyCode, double price, const char *campaignId)
 Tracks a purchase. More...
 
static void trackEvent (const char *name)
 Tracks an event of the given name without category.
 
static void trackEvent (const char *name, int64_t value)
 Tracks an event of the given name without category, with a value. More...
 
static void trackEvent (const char *category, const char *name, int64_t value)
 Tracks an event of the given category and name, with a value.
 
static void trackEvent (const char *category, const char *name, const char *parameter1, const char *parameter2)
 Tracks an event of the given category and name, with two parameters.
 
static void trackEvent (const char *category, const char *name, const char *parameter1, const char *parameter2, int64_t value)
 Tracks an event of the given category and name, with two parameters and a value.
 
static void trackEvent (const char *category, const char *name, const char *parameter1, const char *parameter2, const char *valueName, int64_t value)
 Tracks an event of the given category and name, with two parameters and a named values.
 
static void trackEvent (const char *category, const char *name, const char *parameter1, const char *parameter2, const char *value1Name, int64_t value1, const char *value2Name, int64_t value2)
 Tracks an event of the given category and name, with two parameters and two named values.
 
static void trackEvent (const char *category, const char *name, const char *parameter1, const char *parameter2, const char *value1Name, int64_t value1, const char *value2Name, int64_t value2, const char *value3Name, int64_t value3)
 
static void startSession ()
 Manual session tracking. More...
 
static void endSession ()
 Manual session tracking. More...
 
static void setUserID (const char *userID)
 Assigns a user ID for this user/device. More...
 
static void setUserLevel (int userLevel)
 Sets the level of the user. More...
 
static void setUserFriendCount (int friendCount)
 Sets the friends count of the user. More...
 
static void setAppDataVersion (const char *dataVersion)
 Sets the data version of the App or Game. More...
 
static void setUserCohortVariable (int variableIndex, const char *value)
 Sets a variable of user for the cohort analysis. More...
 
static void setTapjoyViewListener (TJViewListener *listener)
 Set to receive callbacks when Tapjoy views open and close. More...
 
static void setVideoListener (TJVideoListener *listener)
 Sets the video listener. More...
 
static void enablePaidAppWithActionID (const char *paidAppPayPerActionID)
 ONLY USE FOR PAID APP INSTALLS. More...
 
static void actionComplete (const char *actionID)
 Informs the Tapjoy server that the specified Pay-Per-Action was completed. More...
 
static bool isConnected ()
 Helper function to check if SDK is initialized.
 

Detailed Description

C++ API class of the Tapjoy SDK.

Member Function Documentation

static void tapjoy::Tapjoy::actionComplete ( const char *  actionID)
static

Informs the Tapjoy server that the specified Pay-Per-Action was completed.

Should be called whenever a user completes an in-game action.

Parameters
actionIDThe action ID of the completed action.
static void tapjoy::Tapjoy::awardCurrency ( int  amount,
TJAwardCurrencyListener listener 
)
static

Awards virtual currency.

This can only be used for currency managed by Tapjoy. The data will be returned in a callback to onAwardCurrencyResponse() to the class implementing the listener.

Parameters
listenerthe class implementing the TJAwardCurrencyListener callback
static bool tapjoy::Tapjoy::connect ( jobject  context,
const char *  sdkKey,
TJConnectListener listener = NULL 
)
static

Connects to the Tapjoy Server.

Parameters
contexta Java object of the application context.
sdkKeyYour Tapjoy SDK Key.
listenerlistener for connect success/failure
static bool tapjoy::Tapjoy::connect ( const char *  sdkKey,
TJConnectListener listener = NULL 
)
static

Connects to the Tapjoy Server.

Parameters
sdkKeyYour Tapjoy SDK Key.
listenerlistener for connect success/failure
static void tapjoy::Tapjoy::enablePaidAppWithActionID ( const char *  paidAppPayPerActionID)
static

ONLY USE FOR PAID APP INSTALLS.


This method should be called in the onCreate() method of your first activity after calling Must enable a paid app Pay-Per-Action on the Tapjoy dashboard. Starts a 15 minute timer. After which, will send an actionComplete call with the paid app PPA to inform the Tapjoy server that the paid install PPA has been completed.

Parameters
paidAppPayPerActionIDThe Pay-Per-Action ID for this paid app download action.
static void tapjoy::Tapjoy::endSession ( )
static

Manual session tracking.

Notifies the SDK that the session of your application has been ended.

static void tapjoy::Tapjoy::getCurrencyBalance ( TJGetCurrencyBalanceListener listener)
static

Gets the virtual currency data from the server for this device.

The data will be returned in a callback to onCurrencyBalanceResponse() to the class implementing the listener.

Parameters
listenerthe class implementing the TapjoyCurrencyBalanceListener callback
static float tapjoy::Tapjoy::getCurrencyMultiplier ( )
static

Gets the multiplier for the virtual currency display.

Returns
Currency multiplier.
static const char* tapjoy::Tapjoy::getVersion ( )
static

Returns the version name of the SDK.

Returns
a string which represents the version name
static void tapjoy::Tapjoy::setAppDataVersion ( const char *  dataVersion)
static

Sets the data version of the App or Game.

Parameters
dataVersionthe data version
static void tapjoy::Tapjoy::setCurrencyMultiplier ( float  multiplier)
static

ONLY USE FOR NON-MANAGED (by TAPJOY) CURRENCY.


Sets the multiplier for the virtual currency displayed in Offers, Banner Ads, etc. The default is 1.0

Parameters
multiplier
static void tapjoy::Tapjoy::setDebugEnabled ( bool  enable)
static

Enables the debug mode of the SDK.

Parameters
enabletrue to enable
static void tapjoy::Tapjoy::setEarnedCurrencyListener ( TJEarnedCurrencyListener listener)
static

Sets the listener which gets informed whenever virtual currency is earned.

Parameters
listenerclass implementing TJEarnedCurrencyListener
static jint tapjoy::Tapjoy::setJavaVM ( JavaVM *  vm)
static

Sets the JavaVM instance to interoperate with Java for Android only.

This method is equivalent to Tapjoy.initStaticLibrary() in Java.

Parameters
vma pointer to JavaVM instance
static void tapjoy::Tapjoy::setTapjoyViewListener ( TJViewListener listener)
static

Set to receive callbacks when Tapjoy views open and close.

Parameters
listeneronOffersResponse to receive open/close callbacks
static void tapjoy::Tapjoy::setUserCohortVariable ( int  variableIndex,
const char *  value 
)
static

Sets a variable of user for the cohort analysis.

Parameters
variableIndexthe index of the variable to set, must be in the range 1 to 5
valuethe value of the variable to set, or null to unset
static void tapjoy::Tapjoy::setUserFriendCount ( int  friendCount)
static

Sets the friends count of the user.

Parameters
friendCountthe number of friends
static void tapjoy::Tapjoy::setUserID ( const char *  userID)
static

Assigns a user ID for this user/device.

This is used to identify the user in your application.

This is REQUIRED for NON-MANAGED currency apps.

Parameters
userIDuser ID you wish to assign to this device
static void tapjoy::Tapjoy::setUserLevel ( int  userLevel)
static

Sets the level of the user.

Parameters
userLevelthe level of the user
static void tapjoy::Tapjoy::setVideoListener ( TJVideoListener listener)
static

Sets the video listener.

Use this to receive callbacks for on video start, complete and error.

Parameters
listenervideo to receive start/complete/error callbacks
static void tapjoy::Tapjoy::showOffers ( TJOffersListener listener)
static

Show available offers to the user.

Data is returned to the callback

Parameters
listenerThe class implementing the TapjoyOffersListener callback.
static void tapjoy::Tapjoy::showOffersWithCurrencyID ( const char *  currencyID,
bool  enableCurrencySelector,
TJOffersListener listener 
)
static

Show available offers using a currencyID and currency selector flag.

This should only be used if the application supports multiple currencies and is NON-MANAGED by Tapjoy. Data is returned to the callback

Parameters
currencyIDID of the currency to display.
enableCurrencySelectorwhether to display the currency selector to toggle currency.
listenerthe class implementing the TapjoyOffersListener callback.
static void tapjoy::Tapjoy::spendCurrency ( int  amount,
TJSpendCurrencyListener listener 
)
static

Spends virtual currency.

This can only be used for currency managed by Tapjoy. The data will be returned in a callback to onSpendCurrencyResponse() to the class implementing the listener.

Parameters
listenerthe class implementing the TapjoySpendCurrencyListener callback
static void tapjoy::Tapjoy::startSession ( )
static

Manual session tracking.

Notifies the SDK that new session of your application has been started.

static void tapjoy::Tapjoy::trackEvent ( const char *  name,
int64_t  value 
)
static

Tracks an event of the given name without category, with a value.

Parameters
namethe name of event
valuethe value of event
static void tapjoy::Tapjoy::trackPurchase ( const char *  productId,
const char *  currencyCode,
double  price,
const char *  campaignId 
)
static

Tracks a purchase.

Parameters
productIdthe product identifier
currencyCodethe currency code of price as an alphabetic currency code specified in ISO 4217, i.e. "USD", "KRW"
pricethe price of product
campaignIdthe campaign id of the Purchase Action Request if it initiated this purchase, can be null

The documentation for this class was generated from the following file: