Package com.tapjoy

Class Tapjoy

java.lang.Object
com.tapjoy.Tapjoy

public final class Tapjoy extends Object
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
  • Constructor Details

    • Tapjoy

      public Tapjoy()
  • Method Details

    • getVersion

      public static String 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

      public static boolean connect(android.content.Context context, String sdkKey)
      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. See TapjoyConnectFlag for possible values.

      Implement TJConnectListener to receive callbacks on connect success or failure.
      Parameters:
      applicationContext - The application context.
      sdkKey - Your Tapjoy SDK Key.
      flags - special connect flags
      publisherListener - listener for connect success/failure
      Returns:
      true if successful
    • getPlacement

      public static TJPlacement getPlacement(String placementName, TJPlacementListener listener)
      Creates a TJPlacement object used for requesting content
      Parameters:
      placementName - placement name configured in the dashboard
      listener - listener for placement events
      Returns:
      TJPlacement object
    • setActivity

      @Deprecated public static void setActivity(android.app.Activity activity)
      Deprecated.
      Deprecated since 14.0.0 Sets the current activity
      Parameters:
      activity - the reference to your activity
    • getCurrencyBalance

      public static void getCurrencyBalance(TJGetCurrencyBalanceListener listener)
      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

      public static void spendCurrency(int amount, TJSpendCurrencyListener listener)
      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 currency
      listener - the class implementing the TapjoySpendCurrencyListener callback
    • awardCurrency

      public static void awardCurrency(int amount, TJAwardCurrencyListener listener)
      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 currency
      listener - the class implementing the TJAwardCurrencyListener callback
    • setEarnedCurrencyListener

      public static void setEarnedCurrencyListener(TJEarnedCurrencyListener listener)
      Sets the listener which gets informed whenever virtual currency is earned.
      Parameters:
      listener - class implementing TJEarnedCurrencyListener
    • trackPurchase

      public static void trackPurchase(String currencyCode, double price)
      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 identifier
      currencyCode - the currency code of price as an alphabetic currency code specified in ISO 4217, i.e. "USD", "KRW"
      price - the price of product
      campaignId - 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

      public static void setUserID(String userID, TJSetUserIDListener listener)
      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 device
      listener - listener for setUserID success/failure
    • getUserID

      public static String 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

      public static Set<String> getUserTags()
      Returns a String set which contains tags on the user.
      Returns:
      list of user tags
    • setUserTags

      public static void setUserTags(Set<String> tags)
      Sets tags for the user.
      Parameters:
      tags - the tags to be set
    • clearUserTags

      public static void clearUserTags()
      Removes all tags from the user.
    • addUserTag

      public static void addUserTag(String tag)
      Adds the given tag to the user if it is not already present.
      Parameters:
      tag - the tag to be added
    • removeUserTag

      public static void removeUserTag(String tag)
      Removes the given tag from the user if it is present.
      Parameters:
      tag - the tag to be removed
    • actionComplete

      @Deprecated public static void actionComplete(String actionID)
      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.
    • loadSharedLibrary

      public static void loadSharedLibrary()
      Load the native shared library of the SDK to use C++ API.
    • setGLSurfaceView

      @Deprecated public static void setGLSurfaceView(android.opengl.GLSurfaceView glSurfaceView)
      Deprecated.
      Deprecated since 14.0.0. Sets the GLSurfaceView to receive callbacks in the GL thread.
      Parameters:
      glSurfaceView - view for callbacks
    • getSupportURL

      @Deprecated public static String 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 public 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.
      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

      public static void setCustomParameter(String customParam)
      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

      public static String getCustomParameter()
      Returns the currently set custom parameter.
      Returns:
      the value of the currently set custom parameter.
    • getPrivacyPolicy

      public static TJPrivacyPolicy 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