Class PrebidMobile
-
- All Implemented Interfaces:
public class PrebidMobileMain class for managing Prebid SDK. It allows to initialize, set log level and manage internal behaviour.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumPrebidMobile.LogLevelLogLevel for logging control.c NONE - no sdk logs. ERROR - sdk logs with error level only. INFO - sdk logs with info level only. WARN - sdk logs with warn level only. DEBUG - sdk logs with debug level only. Noisy level.
-
Field Summary
-
Method Summary
Modifier and Type Method Description static PrebidMobile.LogLevelgetLogLevel()setLogLevel static voidsetLogLevel(PrebidMobile.LogLevel logLevel)Sets log level for the SDK. static LogUtil.PrebidLoggergetCustomLogger()setCustomLogger static voidsetCustomLogger(LogUtil.PrebidLogger logger)Sets custom logger for the SDK. static booleangetPbsDebug()static voidsetPbsDebug(boolean pbsDebug)static intgetTimeoutMillis()setTimeoutMillis. static voidsetTimeoutMillis(int timeoutMillis)Sets connection timeout for bid request. static StringgetStoredAuctionResponse()setStoredAuctionResponse static voidsetStoredAuctionResponse(String storedAuctionResponse)Sets stored auction response for testing purposes. static StringgetAuctionSettingsId()static voidsetAuctionSettingsId(String settingsId)static StringgetCustomStatusEndpoint()setCustomStatusEndpoint static voidsetCustomStatusEndpoint(String url)Sets full valid URL for the /status endpoint of the PBS. static Map<String, String>getStoredBidResponses()static HashMap<String, String>getCustomHeaders()Returns the HashMap containing a list of custom headers to add to requests static voidsetCustomHeaders(HashMap<String, String> customHeaders)HashMap containing a list of custom headers to add to requests static PBSConfiggetPbsConfig()static voidsetPbsConfig(PBSConfig pbsConfig)static intgetCreativeFactoryTimeout()setCreativeFactoryTimeout static voidsetCreativeFactoryTimeout(int creativeFactoryTimeout)Sets creative factory timeout. static intgetCreativeFactoryTimeoutPreRenderContent()Priority Policy: PBSConfig >SDKConfig >Default static voidsetCreativeFactoryTimeoutPreRenderContent(int creativeFactoryTimeoutPreRenderContent)Sets creative factory timeout for prerender content. static booleanisUseCacheForReportingWithRenderingApi()useCacheForReportingWithRenderingApi static booleangetTimeoutModified()static voidsetPrebidServerAccountId(String accountId)static StringgetPrebidServerAccountId()static HostgetPrebidServerHost()static booleanisShareGeoLocation()setShareGeoLocation static voidinitializeSdk(Context context, String serverURL, SdkInitializationListener listener)Initializes the main SDK classes and makes request to Prebid server to check its status. static voidaddStoredBidResponse(String bidder, String responseId)static voidclearStoredBidResponses()static booleanshouldAssignNativeAssetID()static voidassignNativeAssetID(boolean assignNativeAssetID)For assigning ID to the Assets in the Asset array (in Native Ad Request) static booleanisSdkInitialized()Return 'true' if Prebid Rendering SDK is initialized completely static voidcheckGoogleMobileAdsCompatibility(String googleAdsVersion)Check Google Mobile Ads compatibility for original API. static voidcheckGoogleMobileAdsNextGenCompatibility(String googleAdsNextGenVersion)Check Google Mobile Ads Next-Gen SDK compatibility. static voidsetIncludeWinnersFlag(boolean includeWinners)Sets 'includewinners' parameter for ad request to receive additional info about winners in response. static booleangetIncludeWinnersFlag()setIncludeWinnersFlag static booleansetIncludeBidderKeysFlag(boolean includeBidderKeys)Sets 'includebidderkeys' parameter for ad request to receive additional info about bidders. static booleangetIncludeBidderKeysFlag()setIncludeBidderKeysFlag static voidregisterPluginRenderer(PrebidMobilePluginRenderer prebidMobilePluginRenderer)Registers plugin renderer for displaying ad in custom wrapper. static voidunregisterPluginRenderer(PrebidMobilePluginRenderer prebidMobilePluginRenderer)Remove plugin renderer. static BooleancontainsPluginRenderer(PrebidMobilePluginRenderer prebidMobilePluginRenderer)Return whether SDK already registered this renderer. static PrebidEventDelegategetEventDelegate()setEventDelegate static voidsetEventDelegate(PrebidEventDelegate eventDelegate)Sets the PrebidEventDelegate instance to handle the auction request and response from the SDK. static booleanshouldDisableStatusCheck()setDisableStatusCheck static voidsetUseCacheForReportingWithRenderingApi(boolean useCacheForReportingWithRenderingApi)Sets boolean for caching ad for rendering API. static voidsetShareGeoLocation(boolean share)Allows the SDK to share geolocation if permission is granted by the user. static voidsetDisableStatusCheck(boolean disableStatusCheck)-
-
Method Detail
-
getLogLevel
static PrebidMobile.LogLevel getLogLevel()
-
setLogLevel
static void setLogLevel(PrebidMobile.LogLevel logLevel)
Sets log level for the SDK.
-
getCustomLogger
static LogUtil.PrebidLogger getCustomLogger()
-
setCustomLogger
static void setCustomLogger(LogUtil.PrebidLogger logger)
Sets custom logger for the SDK.
-
getPbsDebug
static boolean getPbsDebug()
-
setPbsDebug
static void setPbsDebug(boolean pbsDebug)
-
getTimeoutMillis
static int getTimeoutMillis()
-
setTimeoutMillis
static void setTimeoutMillis(int timeoutMillis)
Sets connection timeout for bid request.
-
getStoredAuctionResponse
static String getStoredAuctionResponse()
-
setStoredAuctionResponse
static void setStoredAuctionResponse(String storedAuctionResponse)
Sets stored auction response for testing purposes.
-
getAuctionSettingsId
static String getAuctionSettingsId()
-
setAuctionSettingsId
static void setAuctionSettingsId(String settingsId)
-
getCustomStatusEndpoint
static String getCustomStatusEndpoint()
-
setCustomStatusEndpoint
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 )}.
-
getStoredBidResponses
static Map<String, String> getStoredBidResponses()
-
getCustomHeaders
static HashMap<String, String> getCustomHeaders()
Returns the HashMap containing a list of custom headers to add to requests
- Returns:
externalUserIds as Array.
-
setCustomHeaders
static void setCustomHeaders(HashMap<String, String> customHeaders)
HashMap containing a list of custom headers to add to requests
-
getPbsConfig
static PBSConfig getPbsConfig()
-
setPbsConfig
static void setPbsConfig(PBSConfig pbsConfig)
-
getCreativeFactoryTimeout
static int getCreativeFactoryTimeout()
-
setCreativeFactoryTimeout
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
static int getCreativeFactoryTimeoutPreRenderContent()
Priority Policy: PBSConfig >SDKConfig >Default
- Returns:
creativeFactoryTimeoutPreRender in ms
-
setCreativeFactoryTimeoutPreRenderContent
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)
-
isUseCacheForReportingWithRenderingApi
static boolean isUseCacheForReportingWithRenderingApi()
useCacheForReportingWithRenderingApi
-
getTimeoutModified
static boolean getTimeoutModified()
-
setPrebidServerAccountId
static void setPrebidServerAccountId(String accountId)
-
getPrebidServerAccountId
static String getPrebidServerAccountId()
-
getPrebidServerHost
static Host getPrebidServerHost()
-
isShareGeoLocation
static boolean isShareGeoLocation()
-
initializeSdk
static void initializeSdk(Context context, String serverURL, SdkInitializationListener listener)
Initializes the main SDK classes and makes request to Prebid server to check its status. If you use custom /status endpoint set it with (setCustomStatusEndpoint) 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 getDescription
- Parameters:
context- any context (must be not null)serverURL- the Prebid Server URLlistener- initialization listener (can be null).
-
addStoredBidResponse
static void addStoredBidResponse(String bidder, String responseId)
-
clearStoredBidResponses
static void clearStoredBidResponses()
-
shouldAssignNativeAssetID
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
-
assignNativeAssetID
static void assignNativeAssetID(boolean assignNativeAssetID)
For assigning ID to the Assets in the Asset array (in Native Ad Request)
-
isSdkInitialized
static boolean isSdkInitialized()
Return 'true' if Prebid Rendering SDK is initialized completely
-
checkGoogleMobileAdsCompatibility
static void checkGoogleMobileAdsCompatibility(String googleAdsVersion)
Check Google Mobile Ads compatibility for original API. Show logs if version is not compatible.
- Parameters:
googleAdsVersion- - MobileAds.getVersion().
-
checkGoogleMobileAdsNextGenCompatibility
static void checkGoogleMobileAdsNextGenCompatibility(String googleAdsNextGenVersion)
Check Google Mobile Ads Next-Gen SDK compatibility. Show logs if version is not compatible.
- Parameters:
googleAdsNextGenVersion- - MobileAds.getVersion().
-
setIncludeWinnersFlag
static void setIncludeWinnersFlag(boolean includeWinners)
Sets 'includewinners' parameter for ad request to receive additional info about winners in response.
-
getIncludeWinnersFlag
static boolean getIncludeWinnersFlag()
-
setIncludeBidderKeysFlag
static boolean setIncludeBidderKeysFlag(boolean includeBidderKeys)
Sets 'includebidderkeys' parameter for ad request to receive additional info about bidders.
-
getIncludeBidderKeysFlag
static boolean getIncludeBidderKeysFlag()
-
registerPluginRenderer
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
static void unregisterPluginRenderer(PrebidMobilePluginRenderer prebidMobilePluginRenderer)
Remove plugin renderer. registerPluginRenderer
-
containsPluginRenderer
static Boolean containsPluginRenderer(PrebidMobilePluginRenderer prebidMobilePluginRenderer)
Return whether SDK already registered this renderer.
-
getEventDelegate
static PrebidEventDelegate getEventDelegate()
-
setEventDelegate
static void setEventDelegate(PrebidEventDelegate eventDelegate)
Sets the PrebidEventDelegate instance to handle the auction request and response from the SDK. This allows the SDK to collect some statistical data. The provided delegate will be stored as a weak reference so you need to store reference to it.
- Parameters:
eventDelegate- the instance of PrebidEventDelegate to handle events from the SDK.
-
shouldDisableStatusCheck
static boolean shouldDisableStatusCheck()
-
setUseCacheForReportingWithRenderingApi
static void setUseCacheForReportingWithRenderingApi(boolean useCacheForReportingWithRenderingApi)
Sets boolean for caching ad for rendering API.
-
setShareGeoLocation
static void setShareGeoLocation(boolean share)
Allows the SDK to share geolocation if permission is granted by the user.
-
setDisableStatusCheck
static void setDisableStatusCheck(boolean disableStatusCheck)
- Parameters:
disableStatusCheck- boolean flag for skipping status check If true, the SDK will not check the PBS status during initialization.
-
-
-
-