Class POBCacheManager
-
- All Implemented Interfaces:
public class POBCacheManagerImplementation of the cache manager class, responsible for caching Profile info, requesting service script for OM SDK, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfacePOBCacheManager.UserAgentListenerInterface definition to notify about the result of user agent fetch.
public interfacePOBCacheManager.ProfileResultListenerInterface definition to notify about the result of profile fetch.
-
Field Summary
Fields Modifier and Type Field Description public StringpublisherIdpublic StringuserAgent
-
Constructor Summary
Constructors Constructor Description POBCacheManager(Context context, POBNetworkHandler networkHandler)Constructor
-
Method Summary
Modifier and Type Method Description StringgetPublisherId()Return the cached publisher id. StringgetUserAgent()Before calling this method, make sure to call generateUserAgent, otherwise it will return empty string. voidloadInternalServiceJS(@NonNull() POBMeasurementProvider.POBScriptListener listener)Loads the local omid.js from the assets and stores it inside OMID_JS_CONTENT, function uses loadLocalOmidScript internally to load the omid. voidloadLocalOmidScript(@Nullable() POBMeasurementProvider.POBScriptListener listener)Function is used to read omid.js script from the assets folder and store it into omidJsContent and give callback on success of it. booleanverifyCrashAnalyticsStatus()Check CrashAnalytics status for all the profiles. voidloadMraidJs()To read mraid. StringgetMraidJs()To read mraid. voidgenerateUserAgent(@NonNull() POBCacheManager.UserAgentListener listener)This method fetch the user agent from WebSettings and save it for future reference. StringfetchUserAgent()voidrequestProfileConfiguration(@NonNull() String publisherId, int profileId, @Nullable() Integer versionId, @Nullable() POBCacheManager.ProfileResultListener profileListener)Fetches the configuration for required profile from CDN and caches it. POBProfileInfogetProfileInfo(@NonNull() String profileInfoKey)Function is used to return the cached profileInfo associated with the profileInfoKey voidsaveReceivedBid(@NonNull() JSONObject rawBidJson)Save the raw bid json in received bids queue. voidsaveRenderedBid(@NonNull() JSONObject rawBidJson)Save the raw bid json in rendered bids queue. JSONArraygetCachedBidResponses()-
-
Constructor Detail
-
POBCacheManager
POBCacheManager(Context context, POBNetworkHandler networkHandler)
Constructor- Parameters:
context- Context
-
-
Method Detail
-
getPublisherId
@Nullable() String getPublisherId()
Return the cached publisher id.
- Returns:
Publisher Id.
-
getUserAgent
@NonNull() String getUserAgent()
Before calling this method, make sure to call generateUserAgent, otherwise it will return empty string. Returns user agent string. If user agent is not fetched yet, it will return empty.
- Returns:
user agent string
-
loadInternalServiceJS
void loadInternalServiceJS(@NonNull() POBMeasurementProvider.POBScriptListener listener)
Loads the local omid.js from the assets and stores it inside OMID_JS_CONTENT, function uses loadLocalOmidScript internally to load the omid.js script
- Parameters:
listener- Instance of POBMeasurementProvider.POBScriptListener which is used to give scriptReceived callback
-
loadLocalOmidScript
void loadLocalOmidScript(@Nullable() POBMeasurementProvider.POBScriptListener listener)
Function is used to read omid.js script from the assets folder and store it into omidJsContent and give callback on success of it.
- Parameters:
listener- Instance of POBMeasurementProvider.POBScriptListener for giving the callback on the success of the loading of the omidJSScript
-
verifyCrashAnalyticsStatus
boolean verifyCrashAnalyticsStatus()
Check CrashAnalytics status for all the profiles.
- Returns:
true if CrashAnalytics is enabled for all the profiles, false otherwise.
-
loadMraidJs
void loadMraidJs()
To read mraid.js content from the assets folder and store it into mraidJsContent
-
getMraidJs
@Nullable() String getMraidJs()
To read mraid.js content from the assets folder and store it into mraidJsContent
-
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.
-
fetchUserAgent
@NonNull()@WorkerThread() String fetchUserAgent()
-
requestProfileConfiguration
void requestProfileConfiguration(@NonNull() String publisherId, int profileId, @Nullable() Integer versionId, @Nullable() POBCacheManager.ProfileResultListener profileListener)
Fetches the configuration for required profile from CDN and caches it. If the request/response to fetch config fails, we will log the error and rest of the flow will work as it is.
- Parameters:
publisherId- Publisher IdprofileId- profileId for which we require configurationversionId- version of profile
-
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.
-
getCachedBidResponses
@NonNull() JSONArray getCachedBidResponses()
- Returns:
the JSONArray consisting of receivedBids and renderedBids.
-
-
-
-