RewardedVideo - Atmosplay/AtmosplayAds-Android GitHub Wiki
Initialization and request
You should use the testing id in test phase. Testing id won't generate revenue. Please use official id when you release your App.
// Create Reward video object
// context: activity or context
// APP_ID: application ID
mRewardVideo = AtmosplayRewardVideo.init(context, APP_ID)
// Request reward video
// AD_UNIT_ID: ad unit id
// AtmosplayAdLoadListener:you can get request events from the object's callbacks
// To pre-load an ad may take several seconds, so it's recommended to initialize the SDK and load ads as early as possible.
mRewardVideo.loadAd(AD_UNIT_ID, AtmosplayAdLoadListener)
AtmosplayAdLoadListener definition
Display and Destroy
show Rewarded Video
// Show reward video
// AD_UNIT_ID: the same with ad unit id which you use it to load ad
// AtmosplayAdListener: you can get show events from the object's callbacks
mRewardVideo.show(AD_UNIT_ID, AtmosplayAdListener)
AtmosplayAdListener definition
Destroy reward video:
// Destroy ad object
void destroy()
Add Listener
AtmosplayAdLoadListener definition
interface AtmosplayAdLoadListener {
// reward video has been loaded
void onLoadFinished();
// reward video load failed, you can read the message to find out what went wrong with the download.
void onLoadFailed(int errorCode, String message);
}
AtmosplayAdListener definition
interface AtmosplayAdListener {
// the ad game start playing
void onVideoStart();
// the ad game end, game landing page will showing
void onVideoFinished();
// This is a callback of completing the whole event (showing, playing, quitting from landing page), which means the reward shall be given
void onUserEarnedReward();
// error occurs when showing ad
void onAdsError(int code, String msg);
// user click the install button
void onLandingPageInstallBtnClicked();
// ad's finally event
void onAdClosed();
}
Other methods
// The SDK automatically loads the next advertisement after displayed an ad by default. This method can be used to disable automatic loading of the next advertisement.
void setAutoLoadAd(boolean)
// This method can determin whether an add has been loaded.
boolean isReady(AD_UNIT_ID)
The RewardVideoSample file is the Reward Video sample code.