Rewarded 광고

Rewarded ads를 사용하면 사용자가 광고에 참여하는 대가로 게임 계속하기, 가상 화폐 또는 기타 보상과 같은 인앱 아이템을 제공할 수 있습니다. Rewarded ads는 사용자가 자신의 시간에 대해 실질적인 혜택을 받기 때문에 참여도를 높입니다.

다음 섹션에서는 rewarded 광고를 로드하고 보여주는 방법을 설명합니다.

rewarded 광고 로드하기

rewarded 광고를 로드하려면 먼저 rewarded 광고 unit에 해당하는 MaxRewardedAd 객체의 인스턴스를 가져옵니다. 그런 다음 해당 객체의 loadAd() 메서드를 호출합니다. 광고가 준비되었을 때 알림을 받을 수 있도록 MaxRewardedAdListener를 구현합니다. 이를 통해 다른 광고 관련 이벤트에 대한 알림도 받을 수 있습니다.

public class ExampleActivity extends Activity
        implements MaxRewardedAdListener
{
  private MaxRewardedAd rewardedAd;
  private int           retryAttempt;

  void createRewardedAd()
  {
    rewardedAd = MaxRewardedAd.getInstance( "«ad-unit-ID»", this );
    rewardedAd.setListener( this );

    rewardedAd.loadAd();
  }

  // MAX Ad Listener
  @Override
  public void onAdLoaded(final MaxAd maxAd)
  {
    // Rewarded ad is ready to be shown. rewardedAd.isReady() will now return 'true'

    // Reset retry attempt
    retryAttempt = 0;
  }

  @Override
  public void onAdLoadFailed(final String adUnitId, final MaxError error)
  {
    // Rewarded ad failed to load
    // AppLovin recommends that you retry with exponentially higher delays up to a maximum delay (in this case 64 seconds)

    retryAttempt++;
    long delayMillis = TimeUnit.SECONDS.toMillis( (long) Math.pow( 2, Math.min( 6, retryAttempt ) ) );

    new Handler().postDelayed( new Runnable()
    {
      @Override
      public void run()
      {
        rewardedAd.loadAd();
      }
    }, delayMillis );
  }

  @Override
  public void onAdDisplayFailed(final MaxAd maxAd, final MaxError error)
  {
    // Rewarded ad failed to display. AppLovin recommends that you load the next ad.
    rewardedAd.loadAd();
  }

  @Override
  public void onAdDisplayed(final MaxAd maxAd) {}

  @Override
  public void onAdClicked(final MaxAd maxAd) {}

  @Override
  public void onAdHidden(final MaxAd maxAd)
  {
    // rewarded ad is hidden. Pre-load the next ad
    rewardedAd.loadAd();
  }

  @Override
  public void onUserRewarded(final MaxAd maxAd, final MaxReward maxReward)
  {
    // Rewarded ad was displayed and user should receive the reward
  }
}

rewarded 광고 보여주기

rewarded 광고를 보여주려면 생성한 MaxRewardedAd 객체에서 showAd( this )를 호출합니다.

if ( rewardedAd.isReady() )
{
  // `this` is the activity that will be used to show the ad
  rewardedAd.showAd( this );
}

rewarded 광고의 보상 수량 및 통화에 액세스하기

보상 수량 및 통화에 액세스하려면 onUserRewarded() 콜백을 오버라이드합니다:

@Override
public void onUserRewarded(final MaxAd ad, final MaxReward reward)
{
  System.out.println( "Rewarded user: " + reward.getAmount() + " " + reward.getLabel() );
}

S2S rewarded 콜백

귀사의 통화 서버로 콜백을 받을 수 있습니다. 방법을 알아보려면 MAX S2S rewarded 콜백 API 가이드를 참조하세요. 그런 다음 Edit Ad Unit 페이지에서 Server Side Callback URL을 업데이트합니다.

rewarded 광고의 보상 수량 및 통화 설정하기

보상 수량 및 통화를 설정하려면:

  1. Edit Ad Unit 페이지에서 Add S2S Reward Callback을 클릭합니다: Ad Type: ☐App Open, ☐Banner, ☐Interstitial, ☐MRec, ☐Native, ☑Rewarded. Add S2S Reward Callback.
  2. Server Side Callback URL, Reward AmountRewarded Currency Name을 추가합니다: Ad Type: ☐App Open, ☐Banner, ☐Interstitial, ☐MRec, ☐Native, ☑Rewarded. Hide Callback Settings. Server Side Callback URL form field. Reward Amount form field. Rewarded Currency Name form field. AppLovin Event Key form field.

search