Package com.tapjoy
Class Tapjoy
java.lang.Object
com.tapjoy.Tapjoy
Created by Tapjoy.
Copyright 2020 Tapjoy.com All rights reserved.
For information about SDK integration, best practices and FAQs, please go to http://dev.tapjoy.com
Copyright 2020 Tapjoy.com All rights reserved.
For information about SDK integration, best practices and FAQs, please go to http://dev.tapjoy.com
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
actionComplete
(String actionID) Deprecated.Deprecated since 14.1.0.static void
addUserTag
(String tag) Adds the given tag to the user if it is not already present.static void
awardCurrency
(int amount, TJAwardCurrencyListener listener) Awards virtual currency.static void
Removes all tags from the user.static boolean
Connects to the Tapjoy Serverstatic boolean
Connects to the Tapjoy Serverstatic boolean
connect
(android.content.Context applicationContext, String sdkKey, Hashtable<String, ?> flags, TJConnectListener publisherListener) Performs the Tapjoy Connect call to the Tapjoy server to notify it that this device is running your application.
This method should be called in the onCreate() method of your first activity and before any other TapjoyConnect methods.
For special flags, this is a hashtable of special flags to send to enable non-standard settings.static void
Manual session tracking.static void
Gets the virtual currency data from the server for this device.static String
Returns the currently set custom parameter.static int
Gets the maximum level of the user.static TJPlacement
getPlacement
(String placementName, TJPlacementListener listener) Creates a TJPlacement object used for requesting contentstatic TJPrivacyPolicy
Returns the TJPrivacyPolicy instance for calling methods to set GDPR, User's consent, below consent age ,and US Privacy policy flagsstatic String
Deprecated.Deprecated since 14.2.0 Returns URL to Tapjoy support web page.static String
getSupportURL
(String currencyId) Deprecated.Deprecated since 14.2.0 Returns URL to Tapjoy support web page for specified currency You can get your currencyId from the Tapjoy Dashboard under the currency section.static String
Gets the ID of the user.static int
Gets the level of the user.static com.tapjoy.TJSegment
Sets the segment of the userReturns a String set which contains tags on the user.static String
Returns the version name of this SDK release.static boolean
Helper function to check if SDK is initializedstatic void
Load the native shared library of the SDK to use C++ API.static void
onActivityStart
(android.app.Activity activity) Semi-auto session tracking.static void
onActivityStop
(android.app.Activity activity) Semi-auto session tracking.static void
optOutAdvertisingID
(android.content.Context context, boolean optOut) This is to opt out passing advertising_id param in the subsequent network requestsstatic void
removeUserTag
(String tag) Removes the given tag from the user if it is present.static void
setActivity
(android.app.Activity activity) Deprecated.Deprecated since 14.0.0 Sets the current activitystatic void
setCustomParameter
(String customParam) Assign a custom parameter associated with any following placement requests that contains an ad type.static void
setDebugEnabled
(boolean enable) Enables or disables Tapjoy loggingstatic void
Sets the listener which gets informed whenever virtual currency is earned.static void
setGLSurfaceView
(android.opengl.GLSurfaceView glSurfaceView) Deprecated.Deprecated since 14.0.0.static void
setMaxLevel
(int maxUserLevel) Sets the maximum level of the user.static void
setUserID
(String userID, TJSetUserIDListener listener) Assigns a user ID for this user/device.static void
setUserLevel
(int userLevel) Sets the level of the user.static void
setUserSegment
(com.tapjoy.TJSegment userSegment) Sets the segment of the userstatic void
setUserTags
(Set<String> tags) Sets tags for the user.static void
spendCurrency
(int amount, TJSpendCurrencyListener listener) Spends virtual currency.static void
Manual session tracking.static void
trackPurchase
(String currencyCode, double price) Tracks a purchasestatic void
trackPurchase
(String productId, String currencyCode, double price, String campaignId) Deprecated.Deprecated since 14.0.0 Tracks a purchasestatic void
trackPurchase
(String skuDetails, String purchaseData, String dataSignature, String campaignId) Deprecated.Deprecated since 14.0.0.
-
Constructor Details
-
Tapjoy
public Tapjoy()
-
-
Method Details
-
getVersion
Returns the version name of this SDK release.- Returns:
- String instance which represents the version name
-
setDebugEnabled
public static void setDebugEnabled(boolean enable) Enables or disables Tapjoy logging- Parameters:
enable
- set to true if logging should be enabled, false to disable logging
-
connect
Connects to the Tapjoy Server- Parameters:
context
- The application context.sdkKey
- Your Tapjoy SDK Key.- Returns:
- true if successful
- See Also:
-
connect
public static boolean connect(android.content.Context context, String sdkKey, Hashtable<String, ?> flags) Connects to the Tapjoy Server- Parameters:
context
- The application context.sdkKey
- Your Tapjoy SDK Key.flags
- Special connect flags- Returns:
- true if successful
- See Also:
-
connect
public static boolean connect(android.content.Context applicationContext, String sdkKey, Hashtable<String, ?> flags, TJConnectListener publisherListener) Performs the Tapjoy Connect call to the Tapjoy server to notify it that this device is running your application.
This method should be called in the onCreate() method of your first activity and before any other TapjoyConnect methods.
For special flags, this is a hashtable of special flags to send to enable non-standard settings. SeeTapjoyConnectFlag
for possible values.
ImplementTJConnectListener
to receive callbacks on connect success or failure.- Parameters:
applicationContext
- The application context.sdkKey
- Your Tapjoy SDK Key.flags
- special connect flagspublisherListener
- listener for connect success/failure- Returns:
- true if successful
-
getPlacement
Creates a TJPlacement object used for requesting content- Parameters:
placementName
- placement name configured in the dashboardlistener
- listener for placement events- Returns:
- TJPlacement object
-
setActivity
Deprecated.Deprecated since 14.0.0 Sets the current activity- Parameters:
activity
- the reference to your activity
-
getCurrencyBalance
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:
listener
- the class implementing the TapjoyCurrencyBalanceListener callback
-
spendCurrency
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:
amount
- the amount of currencylistener
- the class implementing the TapjoySpendCurrencyListener callback
-
awardCurrency
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:
amount
- the amount of currencylistener
- the class implementing the TJAwardCurrencyListener callback
-
setEarnedCurrencyListener
Sets the listener which gets informed whenever virtual currency is earned.- Parameters:
listener
- class implementing TJEarnedCurrencyListener
-
trackPurchase
Tracks a purchase- Parameters:
currencyCode
- the currency code of price as an alphabetic currency code specified in ISO 4217, i.e. "USD", "KRW"price
- the price of product
-
trackPurchase
@Deprecated public static void trackPurchase(String productId, String currencyCode, double price, String campaignId) Deprecated.Deprecated since 14.0.0 Tracks a purchase- Parameters:
productId
- the product identifiercurrencyCode
- the currency code of price as an alphabetic currency code specified in ISO 4217, i.e. "USD", "KRW"price
- the price of productcampaignId
- the campaign id of this purchase, can be null
-
trackPurchase
@Deprecated public static void trackPurchase(String skuDetails, String purchaseData, String dataSignature, String campaignId) Deprecated.Deprecated since 14.0.0. Tracks a purchase with JSON data from the Google Play store. Also performs In-app Billing validation if purchaseData and dataSignature are given.- Parameters:
skuDetails
- a String in JSON Object format that contains product item details (according to Specification on Google Play)purchaseData
- a String in JSON format that contains details about the purchase order. Use null not to use validation.dataSignature
- String containing the signature of the purchase data that the developer signed with their private key. Use null not to use validation.campaignId
- the campaign id of this purchase, can be null
-
startSession
public static void startSession()Manual session tracking. Notifies the SDK that new session of your application has been started. -
endSession
public static void endSession()Manual session tracking. Notifies the SDK that the session of your application has been ended. -
onActivityStart
public static void onActivityStart(android.app.Activity activity) Semi-auto session tracking. Call this during onStart() of every Activity- Parameters:
activity
- the new activity that is starting
-
onActivityStop
public static void onActivityStop(android.app.Activity activity) Semi-auto session tracking. Call this during onStop() of every Activity.- Parameters:
activity
- the new activity that is stopping
-
setUserID
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:
userID
- user ID you wish to assign to this devicelistener
- listener for setUserID success/failure
-
getUserID
Gets the ID of the user.- Returns:
- the id of the user.
-
getUserLevel
public static int getUserLevel()Gets the level of the user.- Returns:
- the level of the user.
-
setUserLevel
public static void setUserLevel(int userLevel) Sets the level of the user.- Parameters:
userLevel
- the level of the user
-
setMaxLevel
public static void setMaxLevel(int maxUserLevel) Sets the maximum level of the user.- Parameters:
maxUserLevel
- the maximum level
-
getMaxLevel
public static int getMaxLevel()Gets the maximum level of the user.- Returns:
- the maximum level
-
setUserSegment
public static void setUserSegment(com.tapjoy.TJSegment userSegment) Sets the segment of the user- Parameters:
userSegment
- NON_PAYER (0), PAYER (1), VIP (2)
-
getUserSegment
public static com.tapjoy.TJSegment getUserSegment()Sets the segment of the user- Returns:
- userSegment NON_PAYER (0), PAYER (1), VIP (2)
-
getUserTags
Returns a String set which contains tags on the user.- Returns:
- list of user tags
-
setUserTags
Sets tags for the user.- Parameters:
tags
- the tags to be set
-
clearUserTags
public static void clearUserTags()Removes all tags from the user. -
addUserTag
Adds the given tag to the user if it is not already present.- Parameters:
tag
- the tag to be added
-
removeUserTag
Removes the given tag from the user if it is present.- Parameters:
tag
- the tag to be removed
-
actionComplete
Deprecated.Deprecated since 14.1.0. Informs the Tapjoy server that the specified Pay-Per-Action was completed. Should be called whenever a user completes an in-game action.- Parameters:
actionID
- The action ID of the completed action.
-
setGLSurfaceView
Deprecated.Deprecated since 14.0.0. Sets the GLSurfaceView to receive callbacks in the GL thread.- Parameters:
glSurfaceView
- view for callbacks
-
getSupportURL
Deprecated.Deprecated since 14.2.0 Returns URL to Tapjoy support web page. This will use your default currency.- Returns:
- URL of Tapjoy support web page
-
getSupportURL
Deprecated.Deprecated since 14.2.0 Returns URL to Tapjoy support web page for specified currency You can get your currencyId from the Tapjoy Dashboard under the currency section.- Parameters:
currencyId
- the app's currency id- Returns:
- URL of Tapjoy support web page for specified currency
-
isConnected
public static boolean isConnected()Helper function to check if SDK is initialized- Returns:
- true if successful
-
setCustomParameter
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:
customParam
- The custom parameter to assign to this device
-
getCustomParameter
Returns the currently set custom parameter.- Returns:
- the value of the currently set custom parameter.
-
getPrivacyPolicy
Returns the TJPrivacyPolicy instance for calling methods to set GDPR, User's consent, below consent age ,and US Privacy policy flags- Returns:
- The globally accessible singleton TJPrivacyPolicy instance
-
optOutAdvertisingID
public static void optOutAdvertisingID(android.content.Context context, boolean optOut) This is to opt out passing advertising_id param in the subsequent network requests- Parameters:
context
- The application context.optOut
- Enables or disables advertisingID opt out
-