4) 광고 시청을 모두 완료하면 OnUserEarnedReward callback이 호출된 후, 보상을 지급하도록 처리합니다.
publicvoidHandleUserEarnedReward(object sender,Reward args){string type =args.Type;double amount =args.Amount;MonoBehaviour.print("HandleRewardedAdRewarded event received for "+amount.ToString() +" "+ type);}
3. Callback
특정 이벤트를 수신할 수 있습니다. 필요에 따라 구현해주세요.
RewardedAd는 일회용 객체로 보상형 광고가 표시된 후에는 다시 표시되지 않습니다.
이전 광고가 닫힌 직후에 다음 보상형 광고가 로드될 수 있도록 OnAdClosed 에서 다른 보상형 광고를 로드하는 것이 좋습니다.
// Ad event fired when the reward video ad has been received.event EventHandler<EventArgs> OnAdLoaded;// Ad event fired when the reward video ad has failed to load.event EventHandler<AdFailedToLoadEventArgs> OnAdFailedToLoad;// Ad event fired when the reward video ad is opened.event EventHandler<EventArgs> OnAdOpening;// Ad event fired when the reward video ad has failed to show.event EventHandler<AdFailedToLoadEventArgs> OnAdFailedToShow;// Ad event fired when the reward video ad has rewarded the user.event EventHandler<Reward> OnUserEarnedReward;// Ad event fired when the reward video ad is closed.event EventHandler<EventArgs> OnAdClosed;
개발 중 상용 광고 키로 광고를 테스트하려는 경우 아래 단계에 따라 테스트 기기를 등록 후 사용해주시기 바랍니다.
테스트 기기 미등록 상태로 테스트할 경우 계정이 정지될 수 있습니다.
1) ADXLibrary를 적용 후 광고를 로드하는 코드가 삽입된 상태로 실행해주시면 콘솔에서 해당 로그를 확인하실 수 있습니다.
I/Ads:UseRequestConfiguration.Builder.setTestDeviceIds(Arrays.asList("33BE2250B43518CCDA7DE426D04EE231"))to get test ads on this device."
<Google> To get test ads on this device, set:
GADMobileAds.sharedInstance.requestConfiguration
.testDeviceIdentifiers = @[ @"aa20271272d6558e1bff61b329dd436c" ];
2) 출력된 Device ID를 복사하여 아래와 같이 SetTestDeviceIds() 를 호출하여 테스트 기기를 등록해주시면 됩니다.