Show Sidebar

Ad Events

Ads have events which are exposed to the developer using delegates, for eg. a rewarded video ad gives a onAdMediaStart delegate when the ad media starts, hence this is an indicative for the developer to pause all the media being played in the background etc. To handle in app behavior according to Ad-lifecycle events optionally you need to set a VMaxAdDelegate to the VmaxAdView object

 

– (void) onAdReady : (VMaxAdView *)adView

This delegate is received when Ad is ready to render state.

You are expected to call showAd API after this event. In-case showAd API is being called outside this event then you are expected to check AdState as below.

– (void) onAdError : (VMaxAdView *)adView error : (NSError *)error

This delegate is received when the SDK fails to fetch/render an ad. Use the below mentioned APIs on the VmaxAdError object to obtain more information about the error.

Below are the possible values for the error code.


1001 – kVMaxAdErrorNoFill
1002 – kVMaxAdErrorAdRequestNotAllowed
1003 – kVMaxAdErrorPermissionsMissing
1004 – kVMaxAdErrorTimeout
1005 – kVMaxAdErrorInternalServerError
1006 – kVMaxAdErrorSDKInitFailed
1007 – kVMaxAdErrorAdMismatch
1008 – kVMaxAdErrorNetworkError
1009 – kVMaxAdErrorAdParamsMissing
1010 – kVMaxAdErrorAdRenditionFailed
1011 – kVMaxAdErrorAdParsingFailed
1012 – kVMaxAdErrorUnknownError
1013 – kVMaxAdErrorInvalidAdRequest
1014 – kVMaxAdErrorAdExpired
1015 – kVMaxAdErrorDeviceMute

– (void) onAdClose

This delegate is received when ad is closed for full-screen ads. You are expected to resume your application animation loops/in-game sounds etc. It is recommended to cache next ad after this event.

– (void) onAdClick

This delegate is received when the ad is clicked. This will cause your app to go in pause state.

 – (void) onAdMediaStart

It will be triggered when media starts playing.

– (void) onAdMediaEnd : (BOOL)completed reward : (NSInteger)reward

It will be triggered when media ends playing.
boolean Completed: Indicator if the media is completed or not.
NSInteger reward: Applicable only for Rewarded videos. It will expose reward amount to be gratified to the user on completing the media(can be checked using completed flag).

– (void) onAdMediaExpand

It will be triggered when media on a native ad  is expanded to full-screen view.

– (void) onAdMediaCollapse

It will be triggered when media on a native ad  is brought back to normal view from full-screen view.