Sample project to show rewarded ads on your android app
public class MainActivity extends AppCompatActivity implements RewardedVideoListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
...
RewardedAd rewardedAd = RewardedAdFactory.getRewardedAd(this, AdType.ADMOB, this);
rewardedAd.showAd();
...
}
@Override
public void onVideoCompleted() {
Log.v("TEST", "Video completed.");
}
@Override
public void onVideoLoadFailed() {
Log.v("TEST", "Video failed.");
}
@Override
public void onVideoStarted() {
Log.v("TEST", "Video started.");
}
}
3 ad network types are supported. PR's are welcome for other ad networks.
AdType.ADMOB
AdType.CHARTBOOST
AdType.STARTAPP
LifeCycleRegistry is used to handle lifecycle in Ad instances.
LifecycleRegistry lifecycleRegistry = new LifecycleRegistry(this);
lifecycleRegistry.addObserver(rewardedAd.getObserver());
<!-- Chartboost -->
<string name="chartboost_app_id">[REPLACE_CHARTBOOST_APP_ID]</string>
<string name="chartboost_app_signature">[REPLACE_CHARTBOOST_APP_SIGNATURE]</string>
<!-- Admob -->
<string name="admob_unit_id">[REPLACE_ADMOB_AD_UNIT_ID]</string>
<!-- Startapp -->
<string name="startapp_app_id">[REPLACE_STARTAPP_APP_ID]</string>