Before starting this chapter, you have to got finished SDK settings. If not, check 3) Android Settings first. For video Ad, first you have to load a video Ad by invoking TnkSession.prepareVideoAd() method and TnkSession.showVdieoAd() to play it. [Loading a Video Ad] Once your app has started, you have to call initialization method as belows. To load a video Ad, you have to invoke prepareVideoAd() method. Second parameter is the name of Display Logic. (See 5) Display Logic for detail) and third parameter is an instance of VideoAdListener which receives events of video loadings. Fourth parameter is repeat option. If you set this parameter to false, prepareVideoAd() method loads only one video Ad. After playing the video ad, you have to invoke prepareVideAd() again to load next one If you set the parameter to true. prepareVideoAd() automatically loads next video Ad after previous one has been played. [VideoAdListener] To get events from video Ads, you can put an instance of VideoAdListener in the third parameter of prepareVideAd() method. [Video Ad Sample] In this sample , a 'Play' button is shown when a video ad is loaded and the video is played when user clicks the button.Because a thread invoking VideoAdListener is not UI thread, Handler is used to control the visibility of 'Play' button. [Video Ad APIs] - TnkSession.prepareVideoAd() Method - void TnkSession.prepareVideoAd(Activity activity, VideoAdListener listener, boolean repeat) - void TnkSession.prepareVideoAd(Activity activity, String displayLogic, VideoAdListener listener, boolean repeat) Description Load a video Ad. Once the video ad is loaded, you can play it by invoking showVideoAd() method. Parameters
- TnkSession.showVideoAd()Method - void TnkSession.showVideoAd(Activity activity) - void TnkSession.showVideoAd(Activity activity, String displayLogic) Description Play a video ad loaded by prepareVideoAd() method. Parameters
- TnkSession.hasVideoAd()Method - boolean TnkSession.hasVideoAd(Context context) - boolean TnkSession.hasVideoAd(Context context, String displayLogic) Description Returns true if a video ad is loaded and ready for playing. Parameters
|
6. Video Ad >