Class InMobiNative
-
- All Implemented Interfaces:
public final class InMobiNative
Creates an instance of InMobiNative.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
InMobiNative.LockScreenListener
A listener for receiving Lockscreen events during the lifecycle of a Native ad. Register this listener iff your app renders Native ad on Lockscreen.
-
Field Summary
Fields Modifier and Type Field Description private NativeAdEventListener
mPubListener
private final JSONObject
customAdContent
private final String
adTitle
private final String
adDescription
private final String
adIconUrl
private final String
adLandingPageUrl
private final String
adCtaText
private final Float
adRating
private final Boolean
isAppDownload
private final Boolean
isVideo
-
Constructor Summary
Constructors Constructor Description InMobiNative(Context context, Long placementId, NativeAdEventListener listener)
-
Method Summary
Modifier and Type Method Description final NativeAdEventListener
getMPubListener()
final Unit
setMPubListener(NativeAdEventListener mPubListener)
final JSONObject
getCustomAdContent()
final String
getAdTitle()
final String
getAdDescription()
final String
getAdIconUrl()
final String
getAdLandingPageUrl()
final String
getAdCtaText()
final Float
getAdRating()
final Boolean
isAppDownload()
final Boolean
isVideo()
final Unit
setPrimaryViewReturned(Boolean mPrimaryViewReturned)
final Unit
setListener(NativeAdEventListener listener)
Method to update the pub listener final Unit
setVideoEventListener(VideoEventListener listener)
Method to add or update the video events listener for pub 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. final Unit
load(ByteArray response)
Called to render the ad with the provided response. final Unit
load()
Submit a request to load Native ad. final Unit
load(Context context)
Submit a request to load ad content. final Unit
showOnLockScreen(InMobiNative.LockScreenListener lockScreenListener)
Call this method to inform SDK that this Ad will be shown on LockScreen. final Unit
takeAction()
Call this method to take action which is caused by any user interaction with ad view on Lockscreen. final Unit
pause()
Pauses any extra processing associated with this InMobiNative ad. final Unit
resume()
Resumes an InMobiNative ad after a previous call to . final View
getPrimaryViewOfWidth(Context context, View convertView, ViewGroup parent, Integer viewWidthInPixels)
Method to return a native ad view. final Unit
reportAdClickAndOpenLandingPage()
final Boolean
isReady()
Returns true
if the native was loaded successfully and is ready to be shown.final Unit
setExtras(Map<String, String> extras)
Set any additional custom parameters that will be sent in the ad request. final Unit
setKeywords(String keywords)
Set comma delimited keywords for targeting purpose final Unit
setContentUrl(String contentUrl)
Set the current context of the app. final Unit
destroy()
Destroy the Native ad view. -
-
Constructor Detail
-
InMobiNative
InMobiNative(Context context, Long placementId, NativeAdEventListener listener)
- Parameters:
context
- Provide the current context instanceplacementId
- The placementId for which the object is createdlistener
- Listener to get lifecycle callbacks
-
-
Method Detail
-
getMPubListener
final NativeAdEventListener getMPubListener()
-
setMPubListener
final Unit setMPubListener(NativeAdEventListener mPubListener)
-
getCustomAdContent
final JSONObject getCustomAdContent()
-
getAdTitle
final String getAdTitle()
-
getAdDescription
final String getAdDescription()
-
getAdIconUrl
final String getAdIconUrl()
-
getAdLandingPageUrl
final String getAdLandingPageUrl()
-
getAdCtaText
final String getAdCtaText()
-
getAdRating
final Float getAdRating()
-
isAppDownload
final Boolean isAppDownload()
-
setPrimaryViewReturned
final Unit setPrimaryViewReturned(Boolean mPrimaryViewReturned)
-
setListener
final Unit setListener(NativeAdEventListener listener)
Method to update the pub listener
- Parameters:
listener
- Represents the new listener
-
setVideoEventListener
final Unit setVideoEventListener(VideoEventListener listener)
Method to add or update the video events listener for pub
- Parameters:
listener
- Represents the new listener
-
getSignals
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.
-
showOnLockScreen
final Unit showOnLockScreen(InMobiNative.LockScreenListener lockScreenListener)
Call this method to inform SDK that this Ad will be shown on LockScreen. This method should be called before .load or .load.
-
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.
-
reportAdClickAndOpenLandingPage
final Unit reportAdClickAndOpenLandingPage()
-
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
-
-
-
-