Class POBAdsHelper
-
- All Implemented Interfaces:
public class POBAdsHelperAd specific helper class to add common/util implementation for public ad format classes.
-
-
Constructor Summary
Constructors Constructor Description POBAdsHelper()
-
Method Summary
Modifier and Type Method Description static POBImpressiongetImpression(@Nullable() POBRequest request)Returns an instance of impression object created internally. static booleanvalidate(@Nullable() Context context, @Nullable() String publisherId, @Nullable() String adUnitId)Validates the argument to make sure proper initialization of this object. static booleanvalidate(@Nullable() Context context, @Nullable() String publisherId, @Nullable() String adUnitId, @Nullable() Object listener)Validates the argument to make sure proper initialization of this object. static voidrecordImpressionDepth(@NonNull() Context context, @NonNull() POBAdFormat adFormat)Record impression depth for the given ad format static voidrecordLastAdomainFromBid(@NonNull() POBAdFormat adFormat, @Nullable() POBBid bid)Stores the first entry of adomainfrom the rendered bid for subsequentlastadomainbid requests for given adFormat.static <T extends POBAdDescriptor> POBAdResponse<T>updateResponseUsingAdFormatType(@NonNull() POBAdResponse<T> adResponse, @NonNull() POBAdFormat adFormat)Updated the adResponse with the refresh interval and expiry timeout based on the placement type passed static POBImpressioncreateFullScreenImpression(@NonNull() Context context, @NonNull() String adUnitId, @NonNull() POBAdFormat adFormat)Creates an impression using the provided ad unit id and adFormat. static voidupdateAppInstallStatusSignals(@NonNull() Context context, @NonNull() POBImpression impression)Updates POBImpression app install status fields from the current SDK cache. -
-
Method Detail
-
getImpression
@Nullable() static POBImpression getImpression(@Nullable() POBRequest request)
Returns an instance of impression object created internally. It provides APIs to set pubmatic zone id and other custom parameters.
- Returns:
Returns an instance of POBImpression.
-
validate
static boolean validate(@Nullable() Context context, @Nullable() String publisherId, @Nullable() String adUnitId)
Validates the argument to make sure proper initialization of this object.
- Parameters:
context- the context required to load adpublisherId- ID of publisher in PubMatic systemadUnitId- Ad-unit ID (Slot name) in PubMatic system- Returns:
true when all parameters are not null and not empty
-
validate
static boolean validate(@Nullable() Context context, @Nullable() String publisherId, @Nullable() String adUnitId, @Nullable() Object listener)
Validates the argument to make sure proper initialization of this object.
- Parameters:
context- the context required to load adpublisherId- ID of publisher in PubMatic systemadUnitId- Ad-unit ID (Slot name) in PubMatic systemlistener- Valid instance of POBBaseEvent- Returns:
true when all parameters are not null and not empty
-
recordImpressionDepth
static void recordImpressionDepth(@NonNull() Context context, @NonNull() POBAdFormat adFormat)
Record impression depth for the given ad format
- Parameters:
context- ContextadFormat- Ad format for which impression depth needs to be recorded
-
recordLastAdomainFromBid
static void recordLastAdomainFromBid(@NonNull() POBAdFormat adFormat, @Nullable() POBBid bid)
Stores the first entry of
adomainfrom the rendered bid for subsequentlastadomainbid requests for given adFormat.The update logic based on the adFormat is as follows:
- Case 1: For adFormat BANNER_AND_MREC and BANNER response: Updates BANNER_AND_MREC and BANNER
- Case 2: For adFormat BANNER_AND_MREC and MREC response: Updates BANNER_AND_MREC and MREC
- Case 3: For adFormat BANNER: Updates BANNER_AND_MREC and BANNER
- Case 4: For adFormat MREC: Updates BANNER_AND_MREC and MREC
- Case 5: For adFormat INTERSTITIAL: Updates INTERSTITIAL
- Case 6: For adFormat REWARDEDAD: Updates REWARDEDAD
- Case 7: For adFormat NATIVE: Updates NATIVE
- Case 8: For adFormat APP_OPEN_AD: Updates APP_OPEN_AD
- Parameters:
adFormat- The placement type key used for lastadomain mapping; it determines the target formats to update.bid- The winning bid object containing adomain information.
-
updateResponseUsingAdFormatType
@NonNull() static <T extends POBAdDescriptor> POBAdResponse<T> updateResponseUsingAdFormatType(@NonNull() POBAdResponse<T> adResponse, @NonNull() POBAdFormat adFormat)
Updated the adResponse with the refresh interval and expiry timeout based on the placement type passed
- Parameters:
adResponse- Ad Response that needs to be updatedadFormat- AdFormat type of the Ad Response
-
createFullScreenImpression
@Nullable() static POBImpression createFullScreenImpression(@NonNull() Context context, @NonNull() String adUnitId, @NonNull() POBAdFormat adFormat)
Creates an impression using the provided ad unit id and adFormat. Does not populate app-install status cache fields; call updateAppInstallStatusSignals before building a bid request when those signals are required.
- Parameters:
context- Application context for permission checksadUnitId- ad unit id.adFormat- ad format .- Returns:
Impression object
-
updateAppInstallStatusSignals
static void updateAppInstallStatusSignals(@NonNull() Context context, @NonNull() POBImpression impression)
Updates POBImpression app install status fields from the current SDK cache.
- Parameters:
context- Application contextimpression- Impression object
-
-
-
-