use of org.prebid.mobile.RewardedVideoAdUnit in project prebid-mobile-android by prebid.
the class RubiconRewardedVideoMoPubDemoActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
PrebidMobile.setPrebidServerHost(Host.RUBICON);
PrebidMobile.setPrebidServerAccountId(Constants.PBS_ACCOUNT_ID_RUBICON);
PrebidMobile.setStoredAuctionResponse(Constants.PBS_STORED_RESPONSE_VAST_RUBICON);
VideoBaseAdUnit.Parameters parameters = new VideoBaseAdUnit.Parameters();
parameters.setMimes(Arrays.asList("video/mp4"));
parameters.setProtocols(Arrays.asList(Signals.Protocols.VAST_2_0));
// parameters.setProtocols(Arrays.asList(new Signals.Protocols(2)));
parameters.setPlaybackMethod(Arrays.asList(Signals.PlaybackMethod.AutoPlaySoundOff));
// parameters.setPlaybackMethod(Arrays.asList(new Signals.PlaybackMethod(2)));
RewardedVideoAdUnit adUnit = new RewardedVideoAdUnit("1001-1");
adUnit.setParameters(parameters);
this.adUnit = adUnit;
SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder(Constants.MP_ADUNITID_REWARDED).build();
MoPub.initializeSdk(this, sdkConfiguration, null);
MoPubRewardedVideos.setRewardedVideoListener(this);
final Map<String, String> keywordsMap = new HashMap<>();
adUnit.fetchDemand(keywordsMap, new OnCompleteListener() {
@Override
public void onComplete(ResultCode resultCode) {
MoPubRewardedVideoManager.RequestParameters parameters = new MoPubRewardedVideoManager.RequestParameters(Util.convertMapToMoPubKeywords(keywordsMap));
MoPubRewardedVideos.loadRewardedVideo(Constants.MP_ADUNITID_REWARDED, parameters, (MediationSettings) null);
}
});
}
use of org.prebid.mobile.RewardedVideoAdUnit in project prebid-mobile-android by prebid.
the class RubiconRewardedVideoGamDemoActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
PrebidMobile.setPrebidServerHost(Host.RUBICON);
PrebidMobile.setPrebidServerAccountId(Constants.PBS_ACCOUNT_ID_RUBICON);
PrebidMobile.setStoredAuctionResponse(Constants.PBS_STORED_RESPONSE_VAST_RUBICON);
VideoBaseAdUnit.Parameters parameters = new VideoBaseAdUnit.Parameters();
parameters.setMimes(Arrays.asList("video/mp4"));
parameters.setProtocols(Arrays.asList(Signals.Protocols.VAST_2_0));
// parameters.setProtocols(Arrays.asList(new Signals.Protocols(2)));
parameters.setPlaybackMethod(Arrays.asList(Signals.PlaybackMethod.AutoPlaySoundOff));
// parameters.setPlaybackMethod(Arrays.asList(new Signals.PlaybackMethod(2)));
RewardedVideoAdUnit adUnit = new RewardedVideoAdUnit("1001-1");
adUnit.setParameters(parameters);
this.adUnit = adUnit;
final AdManagerAdRequest.Builder builder = new AdManagerAdRequest.Builder();
adUnit.fetchDemand(builder, new OnCompleteListener() {
@Override
public void onComplete(ResultCode resultCode) {
AdManagerAdRequest request = builder.build();
RewardedAd.load(RubiconRewardedVideoGamDemoActivity.this, Constants.DFP_REWARDED_ADUNIT_ID_RUBICON, request, new RewardedAdLoadCallback() {
@Override
public void onAdLoaded(@NonNull RewardedAd rewardedAd) {
super.onAdLoaded(rewardedAd);
rewardedAd.show(RubiconRewardedVideoGamDemoActivity.this, new OnUserEarnedRewardListener() {
@Override
public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
}
});
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
}
});
}
});
}
Aggregations