Class InMobiNative

    • Constructor Detail

      • InMobiNative

        InMobiNative(Context context, Long placementId, NativeAdEventListener listener)
        Parameters:
        context - Provide the current context instance
        placementId - The placementId for which the object is created
        listener - Listener to get lifecycle callbacks
    • Method Detail

      • getSignals

        @Deprecated(message = "Use [InMobiSdk.getToken] instead.") final Unit getSignals()

        Called to create the request payload & the value is returned in NativeAdEventListener.onRequestPayloadCreated callback on success, and in case of failure NativeAdEventListener.onRequestPayloadCreationFailed is invoked.

      • load

         final Unit load(ByteArray response)

        Called to render the ad with the provided response. Once the SDK starts loading the provided response, it will start giving callbacks through NativeAdEventListener listener.

        Parameters:
        response - Represents the response to be used to render an ad
      • load

         final Unit load()

        Submit a request to load Native ad. This method returns immediately upon enqueuing a request. Client code will be notified of the result on the NativeAdEventListener callback that it supplied while instantiating an [ ] object.

        Note** This method must be called on the UI thread. Failure to do so will affect your ability to monetize with the InMobi Ad SDK.

      • load

         final Unit load(Context context)

        Submit a request to load ad content. Use this method in order to change the context where the ad needs to originally load.

        Parameters:
        context - the Context where the ad will be rendered.
      • takeAction

         final Unit takeAction()

        Call this method to take action which is caused by any user interaction with ad view on Lockscreen. This interaction will be reported by

      • pause

         final Unit pause()

        Pauses any extra processing associated with this InMobiNative ad. Your app must call this method in the onPause method of the containing activity or fragment.

        While using InMobiNative with the following constructor .InMobiNative}, or using .load where context as activity there is no need to call .pause.

      • resume

         final Unit resume()

        Resumes an InMobiNative ad after a previous call to .pause. Your app must call this method in the onResume method of the containing activity or fragment.

        While using InMobiNative with the following constructor .InMobiNative},or using .load where context as activity there is no need to call .resume}.

      • getPrimaryViewOfWidth

         final View getPrimaryViewOfWidth(Context context, View convertView, ViewGroup parent, Integer viewWidthInPixels)

        Method to return a native ad view. This method should be called only when the NativeAdEventListener.onAdLoadSucceeded callback was provided.

        Parameters:
        context - Context in which ad will be rendered.
        convertView - Recycled view provided by the Adapter.
        parent - The parent for the primary view
        Returns:

        a native ad view that is constructed by InMobi if ad load was successful, null otherwise.

      • isReady

         final Boolean isReady()

        Returns true if the native was loaded successfully and is ready to be shown.

      • setExtras

         final Unit setExtras(Map<String, String> extras)

        Set any additional custom parameters that will be sent in the ad request.

        Parameters:
        extras - additional custom parameters
      • setKeywords

         final Unit setKeywords(String keywords)

        Set comma delimited keywords for targeting purpose

        Parameters:
        keywords - comma delimited keywords
      • setContentUrl

         final Unit setContentUrl(String contentUrl)

        Set the current context of the app.

        Parameters:
        contentUrl -
        • Represents the contentUrl of the app

      • destroy

         final Unit destroy()

        Destroy the Native ad view.

        Note** This method must be called on the UI thread. Failure to do so will affect your ability to monetize with the InMobi Ad SDK.