java.lang.Object | |
↳ | com.inmobi.ads.InMobiNative |
Use this class to integrate native ads.
Note This class is not thread-safe. All methods on instances of this class must be called on the UI thread.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
InMobiNative.Downloader | This is an API used to control the download the APK into the app and also show the progress while downloading | ||||||||||
InMobiNative.LockScreenListener | A listener for receiving Lockscreen events during the lifecycle of a Native ad. | ||||||||||
InMobiNative.NativeAdListener | A listener for receiving notifications during the lifecycle of a Native ad. | ||||||||||
InMobiNative.NativeAdRequestListener | A listener to notify the outcome of a prefetch ad request. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an instance of
InMobiNative . | |||||||||||
Creates an instance of
InMobiNative . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Destroy the Native ad view.
| |||||||||||
Returns meta info about Ad if any such info is available otherwise returns empty
JSONObject | |||||||||||
Returns creativeId if the Native ad was loaded successfully and creativeId is available
otherwise returns empty string.
| |||||||||||
Method to return a native ad view.
| |||||||||||
Called to create the request payload & the value is returned in
onRequestPayloadCreated(byte[]) callback on success, and in
case of failure onRequestPayloadCreationFailed(InMobiAdRequestStatus) is
invoked. | |||||||||||
Returns
true if the native was loaded successfully and is ready to be shown. | |||||||||||
This api provides information if the ad returned contains a video or not.
| |||||||||||
Submit a request to load ad content.
| |||||||||||
Submit a request to load Native ad.
| |||||||||||
Called to render the ad with the provided response.
| |||||||||||
Pauses any extra processing associated with this
InMobiNative ad. | |||||||||||
Request for a native ad.
| |||||||||||
Resumes an
InMobiNative ad after a previous call to pause() . | |||||||||||
Method to enable/disable the downloader.
| |||||||||||
Set any additional custom parameters that will be sent in the ad request.
| |||||||||||
Set comma delimited keywords for targeting purpose
| |||||||||||
Method to update the pub listener
| |||||||||||
Method to update the pub listener.
| |||||||||||
Method to add or update the video events listener for pub
| |||||||||||
Call this method to inform SDK that this Ad will be shown on LockScreen.
| |||||||||||
Call this method to take action which is caused by any user interaction with ad view on Lockscreen.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Creates an instance of InMobiNative
.
context | Provide the current context instance |
---|
Creates an instance of InMobiNative
.
context | Provide the current context instance |
---|---|
placementId | The placementId for which the object is created |
listener | Listener to get lifecycle callbacks |
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.
Returns meta info about Ad if any such info is available otherwise returns empty JSONObject
Returns creativeId if the Native ad was loaded successfully and creativeId is available otherwise returns empty string.
convertView | Recycled view provided by the Adapter. |
---|---|
parent | The parent for the primary view |
Method to return a native ad view. This method should be called only when the
onAdLoadSucceeded(InMobiNative)
callback was provided.
context | Context in which ad will be rendered. |
---|---|
convertView | Recycled view provided by the Adapter. |
parent | The parent for the primary view |
Called to create the request payload & the value is returned in
onRequestPayloadCreated(byte[])
callback on success, and in
case of failure onRequestPayloadCreationFailed(InMobiAdRequestStatus)
is
invoked.
Returns true
if the native was loaded successfully and is ready to be shown.
This api provides information if the ad returned contains a video or not. It returns
true
if the ad contains a video and returns false
vice versa.
It will return null
if this method is called in a wrong state, i.e., can be
called only after the onAdLoadSucceeded(InMobiNative)
callback
is given.
Submit a request to load ad content. Use this method in conjunction with the requestAd(Context, InMobiAdRequest, NativeAdRequestListener)
method to load the prefetched ad when the monetization event is
imminent.
context | the Context where the ad will be rendered. |
---|
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 InMobiNative.NativeAdListener
callback that it supplied while instantiating an InMobiNative
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.
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.
response | Represents the response to be used to render an ad |
---|
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(Context, long, NativeAdEventListener)
}, or using load(Context)
where context as activity there is no need to call pause()
.
Request for a native ad. Use this method to prefetch native ads in your application. This method returns
immediately after submitting a request. You will be notified via the InMobiNative.NativeAdRequestListener
implementation that you supply in this call when the ad request completes.
Note: This method keeps a
weak reference to the InMobiNative.NativeAdRequestListener
instance and will be garbage collected if you do not keep a
strong reference to it. To receive callbacks when an request is completed caller should keep strong reference of
InMobiNative.NativeAdRequestListener
.
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.
context | any Context implementation |
---|---|
adRequest | an InMobiAdRequest to help customize the ad request |
listener | an InMobiNative.NativeAdRequestListener implementation that will be called when the ad request
completes
|
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(Context, long, NativeAdEventListener)
},or using load(Context)
where context as activity there is no need to call resume()
}.
Method to enable/disable the downloader. If disabled, then the SDK won't download the APK on it's own.
downloaderEnabled | Represents whether the downloader is enabled or not. |
---|
Set any additional custom parameters that will be sent in the ad request.
Set comma delimited keywords for targeting purpose
Method to update the pub listener
listener | Represents the new listener |
---|
Method to update the pub listener. Use setListener(NativeAdEventListener)
instead.
listener | Represents the new listener |
---|
Method to add or update the video events listener for pub
listener | Represents the new listener |
---|
Call this method to inform SDK that this Ad will be shown on LockScreen. This method should be called before
load(Context)
or load()
.
Call this method to take action which is caused by any user interaction with ad view on Lockscreen. This interaction will be reported by
This method should be called
by app after