Class MyTargetManager

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static void clearDiskCache() Clears disk cache.
      static String getBidderToken(@NonNull() Context context) Obtaining a token for the server auction.
      static long getDiskCacheMaxSize() Gets the maximum size of disk cache in bytes.
      static long getDiskCacheTtl() Gets time-to-live for disk cache entries in milliseconds.
      static MyTargetConfig getSdkConfig()
      static void initSdk(@NonNull() Context context) Initializes sdk to make first ad request faster.
      static boolean isSdkInitialized() Returns the SDK initialization status
      static void setDebugMode(boolean debugMode) Enable / disable debug mode (default false).
      static void setDiskCacheMaxSize(long maxCacheSizeBytes) Sets the maximum size of disk cache in bytes.
      static void setDiskCacheTtl(long cacheTtlMs) Sets time-to-live for disk cache entries in milliseconds.
      static void setSdkConfig(@NonNull() MyTargetConfig config) Configuration with global settings can be set to SDK.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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

      • 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