com.google.ads.interactivemedia.v3.api.AdDisplayContainer Java Examples

The following examples show how to use com.google.ads.interactivemedia.v3.api.AdDisplayContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImaPlayer.java    From google-media-framework-android with Apache License 2.0 5 votes vote down vote up
/**
 * Create an ads request which will request the VAST document with the given ad tag URL.
 * @param tagUrl URL pointing to a VAST document of an ad.
 * @return a request for the VAST document.
 */
private AdsRequest buildAdsRequest(String tagUrl) {
  AdDisplayContainer adDisplayContainer = ImaSdkFactory.getInstance().createAdDisplayContainer();
  adDisplayContainer.setPlayer(videoAdPlayer);
  adDisplayContainer.setAdContainer(adUiContainer);
  AdsRequest request = ImaSdkFactory.getInstance().createAdsRequest();
  request.setAdTagUrl(tagUrl);
  request.setContentProgressProvider(contentProgressProvider);

  request.setAdDisplayContainer(adDisplayContainer);
  return request;
}
 
Example #2
Source File: AudioPlayerService.java    From googleads-ima-android with Apache License 2.0 5 votes vote down vote up
public void initializeAds(Context context, ViewGroup companionView) {
  ImaSdkFactory sdkFactory = ImaSdkFactory.getInstance();
  AdDisplayContainer container =
      ImaSdkFactory.createAudioAdDisplayContainer(context, imaService.imaVideoAdPlayer);
  CompanionAdSlot companionAdSlot = sdkFactory.createCompanionAdSlot();
  companionAdSlot.setContainer(companionView);
  companionAdSlot.setSize(300, 250);
  container.setCompanionSlots(ImmutableList.of(companionAdSlot));
  imaService.init(container);
}
 
Example #3
Source File: ImaService.java    From googleads-ima-android with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the ImaService. Note: Ad playback with CompanionAds requires an AdDisplayContainer
 * from the MainActivity.
 */
public void init(AdDisplayContainer adDisplayContainer) {
  adsLoader = sdkFactory.createAdsLoader(context, imaSdkSettings, adDisplayContainer);
  adsLoader.addAdErrorListener(this);
  adsLoader.addAdsLoadedListener(this);

  progressTracker = new ImaProgressTracker(imaVideoAdPlayer);
}