Tapjoy SDK - C++ API
 
Loading...
Searching...
No Matches
tapjoy::Tapjoy Class Reference

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

#include <TapjoyCpp.h>

Static Public Member Functions

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.
 
static void setDebugEnabled (bool enable)
 Enables the debug mode of the SDK.
 
static bool connect (jobject context, const char *sdkKey, const std::map< const char *, const char * > &flags, TJConnectListener *listener=NULL)
 Connects to the Tapjoy Server.
 
static bool connect (jobject context, const char *sdkKey, TJConnectListener *listener=NULL)
 Connects to the Tapjoy Server.
 
static void optOutAdvertisingID (jobject context, bool optOut)
 This is to opt out passing advertising_id param in the subsequent network requests.
 
static bool connect (const char *sdkKey, TJConnectListener *listener=NULL)
 Connects to the Tapjoy Server.
 
static bool connect (const char *sdkKey, const std::map< const char *, const char * > &flags, TJConnectListener *listener=NULL)
 Connects to the Tapjoy Server.
 
static void getCurrencyBalance (TJGetCurrencyBalanceListener *listener)
 Gets the virtual currency data from the server for this device.
 
static void spendCurrency (int amount, TJSpendCurrencyListener *listener)
 Spends virtual currency.
 
static void awardCurrency (int amount, TJAwardCurrencyListener *listener)
 Awards virtual currency.
 
static void setEarnedCurrencyListener (TJEarnedCurrencyListener *listener)
 Sets the listener which gets informed whenever virtual currency is earned.
 
static void trackPurchase (const char *currencyCode, double price)
 Tracks a purchase.
 
static void trackPurchase (const char *productId, const char *currencyCode, double price, const char *campaignId)
 Tracks a purchase.
 
static void trackPurchaseInGooglePlayStore (const char *skuDetails, const char *purchaseData, const char *dataSignature, const char *campaignId)
 Tracks a purchase with JSON data from the Google Play store. Also performs In-app Billing validation if purchaseData and dataSignature are given.
 
static void startSession ()
 Manual session tracking.
 
static void endSession ()
 Manual session tracking.
 
static void setUserID (const char *userID, TJSetUserIDListener *listener)
 Assigns a user ID for this user/device.
 
static const char * getUserID ()
 Gets the id of the user.
 
static void setCustomParameter (const char *referrer)
 Assign a custom parameter associated with any following placement requests that contains an ad type.
 
static const char * getCustomParameter ()
 Returns the currently set custom parameter.
 
static int getUserLevel ()
 Gets the level of the user.
 
static void setUserLevel (int userLevel)
 Sets the level of the user.
 
static void setMaxLevel (int maxLevel)
 Sets the maximum level of the user.
 
static int getMaxLevel ()
 Gets the maximum level of the user.
 
static void setUserSegment (int userSegment)
 Sets the segment of the user.
 
static int getUserSegment ()
 Gets the segment of the user.
 
static void clearUserTags ()
 Removes all tags from the user.
 
static void addUserTag (const char *tag)
 Adds the given tag to the user if it is not already present.
 
static void removeUserTag (const char *tag)
 Removes the given tag from the user if it is present.
 
static void actionComplete (const char *actionID)
 Informs the Tapjoy server that the specified Pay-Per-Action was completed. Should be called whenever a user completes an in-game action.
 
static bool isConnected ()
 Helper function to check if SDK is initialized.
 

Detailed Description

C++ API class of the Tapjoy SDK.

Member Function Documentation

◆ actionComplete()

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.

Deprecated
Deprecated since 14.1.0.
Parameters
actionIDThe action ID of the completed action.

◆ addUserTag()

static void tapjoy::Tapjoy::addUserTag ( const char * tag)
static

Adds the given tag to the user if it is not already present.

Parameters
tagthe tag to be added

◆ awardCurrency()

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

◆ connect() [1/4]

static bool tapjoy::Tapjoy::connect ( const char * sdkKey,
const std::map< const char *, const char * > & flags,
TJConnectListener * listener = NULL )
static

Connects to the Tapjoy Server.

Parameters
sdkKeyYour Tapjoy SDK Key.
flagsConnect flags.
listenerlistener for connect success/failure

◆ connect() [2/4]

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

◆ connect() [3/4]

static bool tapjoy::Tapjoy::connect ( jobject context,
const char * sdkKey,
const std::map< const char *, const char * > & flags,
TJConnectListener * listener = NULL )
static

Connects to the Tapjoy Server.

Parameters
contexta Java object of the application context.
sdkKeyYour Tapjoy SDK Key.
flagsConnect flags.
listenerlistener for connect success/failure

◆ connect() [4/4]

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

◆ endSession()

static void tapjoy::Tapjoy::endSession ( )
static

Manual session tracking.

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

◆ getCurrencyBalance()

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

◆ getCustomParameter()

static const char * tapjoy::Tapjoy::getCustomParameter ( )
static

Returns the currently set custom parameter.

Returns
the value of the currently set custom parameter

◆ getMaxLevel()

static int tapjoy::Tapjoy::getMaxLevel ( )
static

Gets the maximum level of the user.

Returns
the max level

◆ getUserID()

static const char * tapjoy::Tapjoy::getUserID ( )
static

Gets the id of the user.

Returns
the id of the user.

◆ getUserLevel()

static int tapjoy::Tapjoy::getUserLevel ( )
static

Gets the level of the user.

Returns
the level of the user.

◆ getUserSegment()

static int tapjoy::Tapjoy::getUserSegment ( )
static

Gets the segment of the user.

Returns
userSegment NON_PAYER (0), PAYER (1), VIP (2)

◆ getVersion()

static const char * tapjoy::Tapjoy::getVersion ( )
static

Returns the version name of the SDK.

Returns
a string which represents the version name

◆ optOutAdvertisingID()

static void tapjoy::Tapjoy::optOutAdvertisingID ( jobject context,
bool optOut )
static

This is to opt out passing advertising_id param in the subsequent network requests.

Parameters
context
optOutset to true to opt out advertising_id in the subsequent requests, false to disable

◆ removeUserTag()

static void tapjoy::Tapjoy::removeUserTag ( const char * tag)
static

Removes the given tag from the user if it is present.

Parameters
tagthe tag to be removed

◆ setCustomParameter()

static void tapjoy::Tapjoy::setCustomParameter ( const char * referrer)
static

Assign a custom parameter associated with any following placement requests that contains an ad type.

We will return this value on the currency callback. Only applicable for publishers who manage their own currency servers. This value does NOT get unset with each subsequent placement request.

Parameters
customParamThe custom parameter to assign to this device

◆ setDebugEnabled()

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

Enables the debug mode of the SDK.

Parameters
enabletrue to enable

◆ setEarnedCurrencyListener()

static void tapjoy::Tapjoy::setEarnedCurrencyListener ( TJEarnedCurrencyListener * listener)
static

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

Parameters
listenerclass implementing TJEarnedCurrencyListener

◆ setMaxLevel()

static void tapjoy::Tapjoy::setMaxLevel ( int maxLevel)
static

Sets the maximum level of the user.

Parameters
maxLevelthe maximum possible level

◆ setUserID()

static void tapjoy::Tapjoy::setUserID ( const char * userID,
TJSetUserIDListener * listener )
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

◆ setUserLevel()

static void tapjoy::Tapjoy::setUserLevel ( int userLevel)
static

Sets the level of the user.

Parameters
userLevelthe level of the user

◆ setUserSegment()

static void tapjoy::Tapjoy::setUserSegment ( int userSegment)
static

Sets the segment of the user.

Parameters
userSegmentNON_PAYER (0), PAYER (1), VIP (2)

◆ spendCurrency()

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

◆ startSession()

static void tapjoy::Tapjoy::startSession ( )
static

Manual session tracking.

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

◆ trackPurchase() [1/2]

static void tapjoy::Tapjoy::trackPurchase ( const char * currencyCode,
double price )
static

Tracks a purchase.

Parameters
currencyCodethe currency code of price as an alphabetic currency code specified in ISO 4217, i.e. "USD", "KRW"
pricethe price of product

◆ trackPurchase() [2/2]

static void tapjoy::Tapjoy::trackPurchase ( const char * productId,
const char * currencyCode,
double price,
const char * campaignId )
static

Tracks a purchase.

Deprecated
Deprecated since 14.0.0
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

◆ trackPurchaseInGooglePlayStore()

static void tapjoy::Tapjoy::trackPurchaseInGooglePlayStore ( const char * skuDetails,
const char * purchaseData,
const char * dataSignature,
const char * campaignId )
static

Tracks a purchase with JSON data from the Google Play store. Also performs In-app Billing validation if purchaseData and dataSignature are given.

Deprecated
Deprecated since 14.0.0
Parameters
skuDetailsa String in JSON Object format that contains product item details (according to Specification on Google Play)
purchaseDataa String in JSON format that contains details about the purchase order. Use null not to use validation.
dataSignatureString containing the signature of the purchase data that the developer signed with their private key. Use null not to use validation.
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: