Class POBCacheManager

  • All Implemented Interfaces:

    
    public class POBCacheManager
    
                        

    Implementation of the cache manager class, responsible for caching Profile info, requesting service script for OM SDK, etc.

    • Constructor Detail

      • POBCacheManager

        POBCacheManager(Context context, POBNetworkHandler networkHandler)
        Constructor
        Parameters:
        context - Context
    • Method Detail

      • loadAssets

         void loadAssets()

        Loads assets required by OW SDK

      • loadSDKConfig

         void loadSDKConfig()

        Starts a background load of MRAID SDK config when allowed (TTL / in-flight rules in POBSdkConfigHelper). Intended for com.pubmatic.sdk.common.OpenWrapSDKInitializerImpl

      • verifyCrashAnalyticsStatus

         boolean verifyCrashAnalyticsStatus()

        Check CrashAnalytics status for all the profiles.

        Returns:

        true if CrashAnalytics is enabled for all the profiles, false otherwise.

      • getAppInstallStatus

         boolean getAppInstallStatus()

        Check app install status for all the profiles. If any profile disables the feature, we disable it for all the profiles. Uses cached value when profiles have been fetched/updated; otherwise computes from current profile map (e.g. before first profile fetch, or in tests).

        Returns:

        true if app install status is enabled for all profiles, false otherwise.

      • loadMraidJs

         void loadMraidJs()

        To read mraid.js content from the assets folder and store it into mraidJsContent

      • loadOpenWrapJs

         void loadOpenWrapJs()

        To read openwrap.js content from the assets folder and store it into openWrapJsContent

      • getAppStatusSchemes

        @Nullable() JSONObject getAppStatusSchemes()

        Returns the last successfully loaded appInstallStatus.android for MRAID app status usage (e.g. bid imp.ext.owsdk and app-install status checks in the web rendering module). Does not trigger a network request; refreshes are driven by loadSDKConfig (e.g. from SDK init).

      • generateUserAgent

         void generateUserAgent(@NonNull() POBCacheManager.UserAgentListener listener)

        This method fetch the user agent from WebSettings and save it for future reference. And return the callback. If not found then just return user-agent using System.getProperty("http.agent"). It will return empty string in case unable to fetch the user-agent at all.

      • fetchProfileConfigs

         void fetchProfileConfigs(@NonNull() Context context, @NonNull() OpenWrapSDKConfig sdkConfig)

        This method will request the profile configurations from the server and cache them. If the build is a release build, it will also check and toggle the CrashAnalytics status based on the fetched profiles.

        Parameters:
        context - The context of the application.
        sdkConfig - The SDK configuration containing the publisher ID and profile IDs.
      • getProfileInfo

        @Nullable() POBProfileInfo getProfileInfo(@NonNull() String profileInfoKey)

        Function is used to return the cached profileInfo associated with the profileInfoKey

        Parameters:
        profileInfoKey - The profileInfo key associated with the profile and the version
        Returns:

        The POBProfileInfo associated with the profileInfoKey

      • saveReceivedBid

         void saveReceivedBid(@NonNull() JSONObject rawBidJson)

        Save the raw bid json in received bids queue. Remove the oldest one if size of queue is 3.

        Parameters:
        rawBidJson - of ad response.
      • saveRenderedBid

         void saveRenderedBid(@NonNull() JSONObject rawBidJson)

        Save the raw bid json in rendered bids queue. Remove the oldest one if size of queue is 3.

        Parameters:
        rawBidJson - of ad response.