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.

    • 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
      void destroy() Performs the resource cleanup
      void open(@Nullable() String url, boolean userInteracted) Opens the url as a landing page in internal/external browser.
      void expand(@Nullable() String uri, boolean userInteracted, boolean useCustomClose) Expands the MRAID ad as a full screen
      void close() Close the expanded / resized ad.
      void setOrientation(boolean allowOrientationChange, @Nullable() String forceOrientation, boolean userInteracted) Set the orientation of the current activity
      void storePicture(@Nullable() String url, boolean userInteracted) Download and store the image with given URL
      void createCalendarEvent(@NonNull() JSONObject calendarEvent, boolean userInteracted) Creates the calendar event using default calendar app.
      void resize(int width, int height, int offsetX, int offsetY, boolean allowOffscreen, boolean userInteracted) Resize the creative view as per provided size
      void playVideo(@NonNull() String url, boolean userInteracted) Play video inside native player using given media url
      boolean isUserInteracted(boolean overrideClickState) Returns true if user has recently touch/click on MRAID web view.
      void unload() Unloads the current MRAID creative and notify banner to make a call to new ad request
      void listenerChanged(@Nullable() String key, boolean hasListener) Handles the state of the listener based on provide key and state
      void useCustomClose(boolean shouldUseCustomClose) Set the state of useCustomClose
      void checkAppInstallStatus(@NonNull() String bundle) Check the installation status for the given bundle(package-name).
      void onVisibilityChange(boolean visibility) Notifies about the ad visibility state
      • Methods inherited from class java.lang.Object

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

    • 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 false
        useCustomClose - 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 not
        forceOrientation - 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 ad
        height - New resized height of an ad
        offsetX - New x-offset of an ad
        offsetY - New y-offset of an ad
        allowOffscreen - 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 listener
        hasListener - 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

      • onVisibilityChange

         void onVisibilityChange(boolean visibility)

        Notifies about the ad visibility state

        Parameters:
        visibility - true if visibility is Gained and false if visibility looses.