5-1. Rewarded Video for Flutter

비디오 광고 시청 완료 시, 유저에게 리워드가 지급되는 광고 타입 입니다.

사전 작업

05. Flutter-Plugin Guide

UserID Settings

It is used to identify the user for rewarding them upon completion of the rewarded video.

 ONEAdMax.setUserId(userId);

Creating a Rewarded Video Ad Instance

_oamReward = OAMReward()

Reward Video Load

You can request the rewarded video ad from the server by calling the Load() API.The parameters are placementId, networkTimeout, and RewardCallBackListener.

The placementId for the rewarded video ad can be created in the ONE AdMax console.

_oamReward.load(
  placementId: rewardPlacementId,
);

Setting the Network Timeout for Rewarded Video Ad Request

Set the network timeout for the rewarded video ad request. When loading the rewarded video ad, a timeout is given for each ad network (mediation provider). If the ad is not received within the specified timeout, the request will move on to the next ad network.

_oamReward.load(
  networkTimeout: 10
)

보상형 비디오 광고 이벤트 리스너

To set up an event listener for the rewarded video ad, you can use the following approach:

_oamReward.load(
  callback: RewardCallBackListener(
    onLoaded: onLoaded,
    onLoadFailed: onLoadFailed,
    onOpened: onOpened,
    onOpenFailed: onOpenFailed,
    onClosed: onClosed,
    onCompleted: onCompleted,
    onClicked: onClicked,
  )
)
ONE AdMax SDK Error Codes

Call the CS page.

This is the API to call the rewarded video ad CS page. You need to pass the Activity context in order for the page to be displayed correctly.

ONEAdMax.openRewardVideoCSPage(userId)

Extending the application's lifecycle

You need to implement checking the / onResume status of the application where the ad is being displayed.

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    switch (state) {
      case AppLifecycleState.resumed:
        debugPrint("resumed");
        _oamReward.resume()
        break;
      case AppLifecycleState.paused:
        _oamReward.pause();
        break;
    }
    super.didChangeAppLifecycleState(state);
  }

Dispose the rewarded video ad

 @override
void dispose() {
  _oamReward.dispose();
}

Reward Video AD Sample Code

_oamReward = OAMReward()

_oamReward.load(
  placementId: rewardPlacementId,
  callback: RewardCallBackListener(
    onLoaded: onLoaded,
    onLoadFailed: onLoadFailed,
    onOpened: onOpened,
    onOpenFailed: onOpenFailed,
    onClosed: onClosed,
    onCompleted: onCompleted,
    onClicked: onClicked,
  ),
);

_oamReward.show();

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
  switch (state) {
    case AppLifecycleState.resumed:
        _oamReward.resume()
        break;
    case AppLifecycleState.paused:
        _oamReward.pause();
        break;
  }
  super.didChangeAppLifecycleState(state);
}

@override
void dispose() {
  _oamReward.dispose();
  super.dispose();
}

Mediation settings

For stable fill rates and eCPM, it is recommended to set up mediation with AppLovin, Unity Ads, and Vungle.

📌Starting Mediation

Last updated