Class PrebidMobile

java.lang.Object
org.prebid.mobile.PrebidMobile

public class PrebidMobile extends Object
Main class for managing Prebid SDK. It allows to initialize, set log level and manage internal behaviour.
  • Field Details

    • isCoppaEnabled

      public static boolean isCoppaEnabled
    • useExternalBrowser

      public static boolean useExternalBrowser
    • sendMraidSupportParams

      public static boolean sendMraidSupportParams
      If true, the SDK sends "af=3,5", indicating support for MRAID
    • AUTO_REFRESH_DELAY_MIN

      public static final int AUTO_REFRESH_DELAY_MIN
      Minimum refresh interval allowed. 30 seconds
      See Also:
    • AUTO_REFRESH_DELAY_MAX

      public static final int AUTO_REFRESH_DELAY_MAX
      Maximum refresh interval allowed. 120 seconds
      See Also:
    • SCHEME_HTTPS

      public static final String SCHEME_HTTPS
      See Also:
    • SCHEME_HTTP

      public static final String SCHEME_HTTP
      See Also:
    • SDK_VERSION

      public static final String SDK_VERSION
      SDK version
    • SDK_NAME

      public static final String SDK_NAME
      SDK name provided for MRAID_ENV in MraidEnv
      See Also:
    • MRAID_VERSION

      public static final String MRAID_VERSION
      Currently implemented MRAID version.
      See Also:
    • NATIVE_VERSION

      public static final String NATIVE_VERSION
      Currently implemented Native Ads version.
      See Also:
    • OMSDK_VERSION

      public static final String OMSDK_VERSION
      Open measurement SDK version
    • TESTED_GOOGLE_SDK_VERSION

      public static final String TESTED_GOOGLE_SDK_VERSION
      Tested Google SDK version.
      See Also:
    • logLevel

      @Deprecated public static PrebidMobile.LogLevel logLevel
      Deprecated.
      Please use setLogLevel(LogLevel), this field will become private in next releases.
  • Method Details

    • isUseCacheForReportingWithRenderingApi

      public static boolean isUseCacheForReportingWithRenderingApi()
      useCacheForReportingWithRenderingApi
    • setUseCacheForReportingWithRenderingApi

      public static void setUseCacheForReportingWithRenderingApi(boolean useCacheForReportingWithRenderingApi)
      Sets boolean for caching ad for rendering API.
      Parameters:
      useCacheForReportingWithRenderingApi -
    • getTimeoutMillis

      public static int getTimeoutMillis()
    • setTimeoutMillis

      public static void setTimeoutMillis(int timeoutMillis)
      Sets connection timeout for bid request.
    • setPrebidServerAccountId

      public static void setPrebidServerAccountId(String accountId)
    • getPrebidServerAccountId

      public static String getPrebidServerAccountId()
    • setPrebidServerHost

      public static void setPrebidServerHost(Host host)
    • getPrebidServerHost

      public static Host getPrebidServerHost()
    • setShareGeoLocation

      public static void setShareGeoLocation(boolean share)
      Allows the SDK to share geolocation if permission is granted by the user.
    • isShareGeoLocation

      public static boolean isShareGeoLocation()
    • setExternalUserIds

      public static void setExternalUserIds(List<ExternalUserId> externalUserIds)
      List containing objects that hold External User Id parameters for the current application user.
    • getExternalUserIds

      public static List<ExternalUserId> getExternalUserIds()
      Returns the List that hold External UserId parameters for the current application user
      Returns:
      externalUserIds as Array.
    • setCustomHeaders

      public static void setCustomHeaders(HashMap<String,String> customHeaders)
      HashMap containing a list of custom headers to add to requests
    • getCustomHeaders

      public static HashMap<String,String> getCustomHeaders()
      Returns the HashMap containing a list of custom headers to add to requests
      Returns:
      externalUserIds as Array.
    • initializeSdk

      public static void initializeSdk(android.content.Context context, SdkInitializationListener listener)
      Initializes the main SDK classes and makes request to Prebid server to check its status. You have to set host url (setPrebidServerHost(Host)) before calling this method. If you use custom /status endpoint set it with (setCustomStatusEndpoint(String)) before starting initialization.

      Calls SdkInitializationListener callback with enum initialization status parameter:

      SUCCEEDED - Prebid SDK is initialized successfully and ready to work.

      FAILED - Prebid SDK is failed to initialize and is not able to work.

      SERVER_STATUS_WARNING - Prebid SDK failed to check the PBS status. The SDK is initialized and able to work, though.

      To get the description of the problem you can call InitializationStatus.getDescription()

      Parameters:
      context - any context (must be not null)
      listener - initialization listener (can be null).

    • getApplicationContext

      @Deprecated public static android.content.Context getApplicationContext()
      Deprecated.
    • setStoredAuctionResponse

      public static void setStoredAuctionResponse(String storedAuctionResponse)
      Sets stored auction response for testing purposes.
    • getStoredAuctionResponse

      public static String getStoredAuctionResponse()
    • addStoredBidResponse

      public static void addStoredBidResponse(String bidder, String responseId)
    • clearStoredBidResponses

      public static void clearStoredBidResponses()
    • getStoredBidResponses

      public static Map<String,String> getStoredBidResponses()
    • getPbsDebug

      public static boolean getPbsDebug()
    • setPbsDebug

      public static void setPbsDebug(boolean pbsDebug)
    • shouldAssignNativeAssetID

      public static boolean shouldAssignNativeAssetID()
      Returns:
      boolean that states if the ID will be set to the Asset array (in the Native Ad Request) This value can be set using the assignNativeAssetID(boolean)
    • assignNativeAssetID

      public static void assignNativeAssetID(boolean assignNativeAssetID)
      For assigning ID to the Assets in the Asset array (in Native Ad Request)
    • isSdkInitialized

      public static boolean isSdkInitialized()
      Return 'true' if Prebid Rendering SDK is initialized completely
    • getLogLevel

      public static PrebidMobile.LogLevel getLogLevel()
    • setLogLevel

      public static void setLogLevel(PrebidMobile.LogLevel logLevel)
      Sets log level for the SDK.
    • getCustomLogger

      public static LogUtil.PrebidLogger getCustomLogger()
    • setCustomLogger

      public static void setCustomLogger(LogUtil.PrebidLogger logger)
      Sets custom logger for the SDK.
    • checkGoogleMobileAdsCompatibility

      public static void checkGoogleMobileAdsCompatibility(String googleAdsVersion)
      Check Google Mobile Ads compatibility for original API. Show logs if version is not compatible.
      Parameters:
      googleAdsVersion - - MobileAds.getVersion().toString()
    • setCustomStatusEndpoint

      public static void setCustomStatusEndpoint(String url)
      Sets full valid URL for the /status endpoint of the PBS. Request to /status is sent when you call initializeSdk(Context, SdkInitializationListener).
      See Also:
    • getCustomStatusEndpoint

      public static String getCustomStatusEndpoint()
    • setIncludeWinnersFlag

      public static void setIncludeWinnersFlag(boolean includeWinners)
      Sets 'includewinners' parameter for ad request to receive additional info about winners in response.
    • getIncludeWinnersFlag

      public static boolean getIncludeWinnersFlag()
    • setIncludeBidderKeysFlag

      public static boolean setIncludeBidderKeysFlag(boolean includeBidderKeys)
      Sets 'includebidderkeys' parameter for ad request to receive additional info about bidders.
    • getIncludeBidderKeysFlag

      public static boolean getIncludeBidderKeysFlag()
    • getPbsConfig

      public static PBSConfig getPbsConfig()
    • setPbsConfig

      public static void setPbsConfig(PBSConfig pbsConfig)
    • getCreativeFactoryTimeout

      public static int getCreativeFactoryTimeout()
    • setCreativeFactoryTimeout

      public static void setCreativeFactoryTimeout(int creativeFactoryTimeout)
      Sets creative factory timeout. It's time to parse and render banner ads.
      Parameters:
      creativeFactoryTimeout - in ms (default 6000ms)
    • getCreativeFactoryTimeoutPreRenderContent

      public static int getCreativeFactoryTimeoutPreRenderContent()
      Priority Policy: PBSConfig > SDKConfig > Default
      Returns:
      creativeFactoryTimeoutPreRender in ms
    • setCreativeFactoryTimeoutPreRenderContent

      public static void setCreativeFactoryTimeoutPreRenderContent(int creativeFactoryTimeoutPreRenderContent)
      Sets creative factory timeout for prerender content. It's time to parse and render interstitial ads.
      Parameters:
      creativeFactoryTimeoutPreRenderContent - in ms (default 30000ms)
    • registerPluginRenderer

      public static void registerPluginRenderer(PrebidMobilePluginRenderer prebidMobilePluginRenderer)
      Registers plugin renderer for displaying ad in custom wrapper. Prebid SDK will choose this renderer only if the winning bid contains this renderer.
    • unregisterPluginRenderer

      public static void unregisterPluginRenderer(PrebidMobilePluginRenderer prebidMobilePluginRenderer)
    • containsPluginRenderer

      public static Boolean containsPluginRenderer(PrebidMobilePluginRenderer prebidMobilePluginRenderer)
      Return whether SDK already registered this renderer.