Class MyTargetManager
-
- All Implemented Interfaces:
public final class MyTargetManager
-
-
Method Summary
Modifier and Type Method Description static voidclearDiskCache()Clears disk cache. static StringgetBidderToken(@NonNull() Context context)Obtaining a token for the server auction. static longgetDiskCacheMaxSize()Gets the maximum size of disk cache in bytes. static longgetDiskCacheTtl()Gets time-to-live for disk cache entries in milliseconds. static MyTargetConfiggetSdkConfig()static voidinitSdk(@NonNull() Context context)Initializes sdk to make first ad request faster. static booleanisSdkInitialized()Returns the SDK initialization status static voidsetDebugMode(boolean debugMode)Enable / disable debug mode (default false). static voidsetDiskCacheMaxSize(long maxCacheSizeBytes)Sets the maximum size of disk cache in bytes. static voidsetDiskCacheTtl(long cacheTtlMs)Sets time-to-live for disk cache entries in milliseconds. static voidsetSdkConfig(@NonNull() MyTargetConfig config)Configuration with global settings can be set to SDK. -
-
Method Detail
-
clearDiskCache
@AnyThread() static void clearDiskCache()
Clears disk cache. It will be running in background.
-
getBidderToken
@NonNull()@WorkerThread() static String getBidderToken(@NonNull() Context context)
Obtaining a token for the server auction. The method must be called from outside the main thread.
This function returns one of two different tokens dependent on current value of MyTargetPrivacy.isConsent() flag from MyTargetPrivacy.currentPrivacy(). Both tokens are generated once per session and remain unchanged until the application is restarted.
When working with a server-side auction, you must start loading an advertisement with the bid_payload received from the server, for this you need to use the loadFromBid method of the advertisement instance.
- Parameters:
context- app context- Returns:
token for ad bidding
-
getDiskCacheMaxSize
static long getDiskCacheMaxSize()
Gets the maximum size of disk cache in bytes. The value is constrained to be between 50MB and 100GB. Default value is 100 MB, which is also the recommended value.
- Returns:
maximum cache size in bytes
-
getDiskCacheTtl
static long getDiskCacheTtl()
Gets time-to-live for disk cache entries in milliseconds. The value is constrained to be between 30 minutes and 1 week. Default value is 1 day, which is also the recommended value.
- Returns:
cache entry TTL in milliseconds
-
getSdkConfig
@NonNull() static MyTargetConfig getSdkConfig()
- Returns:
current SDK configuration instance
-
initSdk
@AnyThread() static void initSdk(@NonNull() Context context)
Initializes sdk to make first ad request faster.
- Parameters:
context- app context
-
isSdkInitialized
static boolean isSdkInitialized()
Returns the SDK initialization status
- Returns:
true if SDK is initialized, false otherwise
-
setDebugMode
static void setDebugMode(boolean debugMode)
Enable / disable debug mode (default false).
- Parameters:
debugMode- enable or disable debug
-
setDiskCacheMaxSize
static void setDiskCacheMaxSize(long maxCacheSizeBytes)
Sets the maximum size of disk cache in bytes. The value is constrained to be between 50MB and 100GB. If the provided value is less than 50MB, the minimum value of 50MB will be used. If the provided value is greater than 100GB, the maximum value of 100GB will be used. Default value is 100 MB, which is also the recommended value.
If the new size is smaller, older entries will be removed after next cache operation.
- Parameters:
maxCacheSizeBytes- maximum cache size in bytes
-
setDiskCacheTtl
static void setDiskCacheTtl(long cacheTtlMs)
Sets time-to-live for disk cache entries in milliseconds. The value is constrained to be between 30 minutes and 1 week. If the provided value is less than 30 minutes, the minimum value of 30 minutes will be used. If the provided value is greater than 1 week, the maximum value of 1 week will be used. Default value is 1 day, which is also the recommended value.
If the new TTL is shorter, older entries will be removed after next cache operation.
- Parameters:
cacheTtlMs- cache entry TTL in milliseconds
-
setSdkConfig
static void setSdkConfig(@NonNull() MyTargetConfig config)
Configuration with global settings can be set to SDK. New config can be created with MyTargetConfig.Builder
- Parameters:
config- SDK configuration instance
-
-
-
-