Class POBMraidController
-
- All Implemented Interfaces:
-
com.pubmatic.sdk.webrendering.mraid.POBMraidBridgeListener,com.pubmatic.sdk.webrendering.ui.POBAdVisibilityListener
@MainThread() public class POBMraidController implements POBMraidBridgeListener, POBAdVisibilityListener
Controller class to implement the MRAID core features like expand, resize etc.
-
-
Method Summary
Modifier and Type Method Description voiddestroy()Performs the resource cleanup voidopen(@Nullable() String url, boolean userInteracted)Opens the url as a landing page in internal/external browser. voidexpand(@Nullable() String uri, boolean userInteracted, boolean useCustomClose)Expands the MRAID ad as a full screen voidclose()Close the expanded / resized ad. voidsetOrientation(boolean allowOrientationChange, @Nullable() String forceOrientation, boolean userInteracted)Set the orientation of the current activity voidstorePicture(@Nullable() String url, boolean userInteracted)Download and store the image with given URL voidcreateCalendarEvent(@NonNull() JSONObject calendarEvent, boolean userInteracted)Creates the calendar event using default calendar app. voidresize(int width, int height, int offsetX, int offsetY, boolean allowOffscreen, boolean userInteracted)Resize the creative view as per provided size voidplayVideo(@NonNull() String url, boolean userInteracted)Play video inside native player using given media url booleanisUserInteracted(boolean overrideClickState)Returns true if user has recently touch/click on MRAID web view. voidunload()Unloads the current MRAID creative and notify banner to make a call to new ad request voidlistenerChanged(@Nullable() String key, boolean hasListener)Handles the state of the listener based on provide key and state voiduseCustomClose(boolean shouldUseCustomClose)Set the state of useCustomClose voidcheckAppInstallStatus(@NonNull() String bundle)Check the installation status for the given bundle(package-name). voidonVisibilityChange(boolean visibility)Notifies about the ad visibility state -
-
Method Detail
-
destroy
void destroy()
Performs the resource cleanup
-
open
void open(@Nullable() String url, boolean userInteracted)
Opens the url as a landing page in internal/external browser.
- Parameters:
url- Landing page url.
-
expand
void expand(@Nullable() String uri, boolean userInteracted, boolean useCustomClose)
Expands the MRAID ad as a full screen
- Parameters:
uri- If url is passed then expand as a two-part else consider single part expand.userInteracted- true if user interacted with the ad else falseuseCustomClose- true to use custom close button else false
-
close
void close()
Close the expanded / resized ad.
-
setOrientation
void setOrientation(boolean allowOrientationChange, @Nullable() String forceOrientation, boolean userInteracted)
Set the orientation of the current activity
- Parameters:
allowOrientationChange- Check if orientation change is allowed or notforceOrientation- set the provided orientation to activity
-
storePicture
void storePicture(@Nullable() String url, boolean userInteracted)
Download and store the image with given URL
- Parameters:
url- image url.
-
createCalendarEvent
void createCalendarEvent(@NonNull() JSONObject calendarEvent, boolean userInteracted)
Creates the calendar event using default calendar app.
- Parameters:
calendarEvent- Calendar event
-
resize
void resize(int width, int height, int offsetX, int offsetY, boolean allowOffscreen, boolean userInteracted)
Resize the creative view as per provided size
- Parameters:
width- New resized width of an adheight- New resized height of an adoffsetX- New x-offset of an adoffsetY- New y-offset of an adallowOffscreen- state to allow screen off
-
playVideo
void playVideo(@NonNull() String url, boolean userInteracted)
Play video inside native player using given media url
- Parameters:
url- media url to play video
-
isUserInteracted
boolean isUserInteracted(boolean overrideClickState)
Returns true if user has recently touch/click on MRAID web view.
- Returns:
Returns true if user has recently touch/click on MRAID web view else return false
-
unload
void unload()
Unloads the current MRAID creative and notify banner to make a call to new ad request
-
listenerChanged
void listenerChanged(@Nullable() String key, boolean hasListener)
Handles the state of the listener based on provide key and state
- Parameters:
key- Name of the listenerhasListener- true if listener needs to be attached and false if needs to be detach/remove
-
useCustomClose
void useCustomClose(boolean shouldUseCustomClose)
Set the state of useCustomClose
-
checkAppInstallStatus
void checkAppInstallStatus(@NonNull() String bundle)
Check the installation status for the given bundle(package-name).
-
onVisibilityChange
void onVisibilityChange(boolean visibility)
Notifies about the ad visibility state
- Parameters:
visibility- true if visibility is Gained and false if visibility looses.
-
-
-
-