Class NativeFlowManager
-
- All Implemented Interfaces:
-
com.inmobi.ads.core.WinLossNotifier
public final class NativeFlowManager implements WinLossNotifier
Flow manager for native ads, coordinating the entire lifecycle of native ad operations. This class manages the flow from ad loading to rendering, handling publisher interactions, callbacks, and lifecycle management for native ads.
-
-
Constructor Summary
Constructors Constructor Description NativeFlowManager(InMobiNative inMobiNative, Context context, Long placementId)
-
Method Summary
Modifier and Type Method Description final Unitload()Loads a native ad using non-audience bidding placement type. final Unitload(ByteArray response)Loads a native ad using audience bidding with a pre-bid response. final UnitregisterViewForTracking(InMobiNativeViewData inMobiNativeViewData)Registers the provided view data for tracking impressions and clicks. final UnitunTrackViews()Removes tracking from all registered views. final UnitsetListener(NativeAdEventListener adEventListener)Sets the ad event listener for receiving native ad lifecycle callbacks. final UnitsetVideoEventListener(VideoEventListener videoEventListener)Sets the video event listener for receiving video-related callbacks. final UnitsetLockscreenListener(InMobiNative.LockScreenListener lockScreenListener)Sets the lock screen listener and enables lock screen functionality. final UnitsetExtras(Map<String, String> extras)Sets additional extras for the ad request including third-party information. final UnitsetKeywords(String keywords)Sets keywords for targeting the ad request. final UnitsetContentUrl(String contentUrl)Sets the content URL for the ad request to improve targeting. final NativePubDatagetNativePubData()Gets the current native public data if available. final UnittakeAction()Handles user actions (such as clicks) on the native ad. StringnotifyWin(Double minBidToWin)Notify that the bid for this ad was won. StringnotifyLoss(Integer lossReason, Double auctionPrice)Notify that the bid for this ad was lost. final Unitdestroy()Destroys the flow manager and cleans up all resources. -
-
Constructor Detail
-
NativeFlowManager
NativeFlowManager(InMobiNative inMobiNative, Context context, Long placementId)
- Parameters:
inMobiNative- The InMobiNative instance associated with this flow manager.context- The Android context required for ad operations.placementId- The placement ID for the native ad.
-
-
Method Detail
-
load
final Unit load()
Loads a native ad using non-audience bidding placement type. This method initiates the ad loading process without pre-bid response.
-
load
final Unit load(ByteArray response)
Loads a native ad using audience bidding with a pre-bid response. This method loads the ad using the provided response data.
- Parameters:
response- The pre-bid response data as a byte array.
-
registerViewForTracking
final Unit registerViewForTracking(InMobiNativeViewData inMobiNativeViewData)
Registers the provided view data for tracking impressions and clicks.
- Parameters:
inMobiNativeViewData- The view data containing all views that need to be tracked.
-
unTrackViews
final Unit unTrackViews()
Removes tracking from all registered views.
This method should be called when views are no longer visible or when cleaning up the native ad to prevent memory leaks and stop tracking.
-
setListener
final Unit setListener(NativeAdEventListener adEventListener)
Sets the ad event listener for receiving native ad lifecycle callbacks.
- Parameters:
adEventListener- The listener for native ad events.
-
setVideoEventListener
final Unit setVideoEventListener(VideoEventListener videoEventListener)
Sets the video event listener for receiving video-related callbacks.
- Parameters:
videoEventListener- The listener for video events.
-
setLockscreenListener
final Unit setLockscreenListener(InMobiNative.LockScreenListener lockScreenListener)
Sets the lock screen listener and enables lock screen functionality.
- Parameters:
lockScreenListener- The listener for lock screen events.
-
setExtras
final Unit setExtras(Map<String, String> extras)
Sets additional extras for the ad request including third-party information.
- Parameters:
extras- A map of key-value pairs containing additional request parameters.
-
setKeywords
final Unit setKeywords(String keywords)
Sets keywords for targeting the ad request.
- Parameters:
keywords- Comma-separated keywords for ad targeting.
-
setContentUrl
final Unit setContentUrl(String contentUrl)
Sets the content URL for the ad request to improve targeting.
- Parameters:
contentUrl- The URL of the content where the ad will be displayed.
-
getNativePubData
final NativePubData getNativePubData()
Gets the current native public data if available.
- Returns:
The NativePubData containing native ad information, or null if not loaded.
-
takeAction
final Unit takeAction()
Handles user actions (such as clicks) on the native ad.
-
notifyWin
String notifyWin(Double minBidToWin)
Notify that the bid for this ad was won. Delegates to the Native Ad Unit Manager to handle Win beacon firing.
- Parameters:
minBidToWin- The minimum bid amount required to win the auction- Returns:
An error message string if the notification failed, null if successful
-
notifyLoss
String notifyLoss(Integer lossReason, Double auctionPrice)
Notify that the bid for this ad was lost. Delegates to the Native Ad Unit Manager to handle Loss beacon firing.
- Parameters:
lossReason- The reason code for losing the auctionauctionPrice- The price of the winning bid in the auction- Returns:
An error message string if the notification failed, null if successful
-
-
-
-