기술 자료

Development

User Acquisition

Monetization

산업 분야

Unity Ads Monetization

SDK 4.20.0

지원 가능
​

Android API reference

Unity Ads Monetization

SDK 4.20.0

지원 가능
​

이 페이지는 선택한 언어로 제공되지 않습니다.
Android developer guides
​
​
Android developer guides
  • Android SDK integration guide
  • Unity Ads privacy guide
  • Unity Ads SDK troubleshooting guide
  • Android developer API references
  1. Unity Ads SDK Android developer monetization
  2. Unity Ads SDK integration guide for Android developers

Implement banner ads in Android

Implement banner ads in your Android app. Create banner view objects, display them in your layout, and use a listener to manage ad events.
읽는 시간 2분
최근 업데이트: 한 달 전

Banner ads require a specific type of dedicated banner placement.
You can place the banner view object into your view hierarchy, just like you would any other view. This allows you to customize the position of each banner instance, or display multiple banners.
참고
app-ads.txt is an IAB initiative to combat fraud and create transparency in the advertising ecosystem. Ensure that you set up the app-ads.txt file as described. Otherwise, banner demand might be significantly decreased.

Script implementation

The following script sample is an example implementation for displaying two banner ads on the screen, and buttons for testing them.
This example uses a single listener for multiple banner view objects. You can also have a different listener for each banner view object.

Implementing the MREC banner format

To display a medium rectangle (MREC) sized ad format in your app, ensure the proper dimensions are used, such as 300x250, 300x300, or 450x450. In the case of a 300x250 MREC banner ad specifically, replace this in the following example code:
new UnityBannerSize(320, 50)
With this adjusted dimension:
new UnityBannerSize(300, 250)

Banner ad example

Construct a
BannerShowListener
to handle impression, click, and show failure events, then pass it into
BannerConfiguration.Builder
along with the placement ID and a
BannerSize
, which supports fixed or adaptive dimensions for anchored and inline layouts. Optionally include mediation metadata and ad markup for bidding, then call
BannerAd.load()
with the built configuration and a
LoadListener
. On a successful load, retrieve the banner's
View
via
ad.getView()
to insert it into your layout.
BannerShowListener showListener = new BannerShowListener() { @Override public void onImpression(@NonNull BannerAd ad) { /* impression */ } @Override public void onClicked(@NonNull BannerAd ad) { /* clicked */ } @Override public void onFailedToShow(@NonNull BannerAd ad, @NonNull UnityAdsError error) { /* show failure */ } }; BannerConfiguration.Builder builder = new BannerConfiguration.Builder( placementId, new BannerSize( 320, 50 ), showListener ) .withMediationInfo( createMediationInfo() ); if ( AppLovinSdkUtils.isValidString( bidResponse ) ) { builder.withAdMarkup( bidResponse ); } BannerAd.load( builder.build(), new LoadListener<BannerAd>() { @Override public void onAdLoaded(@Nullable BannerAd ad, @Nullable UnityAdsError error) { if ( error == null ) { loadedBannerAd = ad; listener.onAdViewAdLoaded( ad.getView() ); // retrieve view via getView() } else { // failure } } } );
val showListener = object : BannerShowListener { override fun onImpression(ad: BannerAd) { /* impression */ } override fun onClicked(ad: BannerAd) { /* clicked */ } override fun onFailedToShow(ad: BannerAd, error: UnityAdsError) { /* show failure */ }}val builder = BannerConfiguration.Builder(placementId, BannerSize(320, 50), showListener) .withMediationInfo(createMediationInfo())if (AppLovinSdkUtils.isValidString(bidResponse)) { builder.withAdMarkup(bidResponse)}BannerAd.load(builder.build(), object : LoadListener<BannerAd> { override fun onAdLoaded(ad: BannerAd?, error: UnityAdsError?) { if (error == null) { loadedBannerAd = ad listener.onAdViewAdLoaded(ad.getView()) // retrieve view via getView() } else { // failure } }})
Next steps: Review the monetization strategy guide or test your implementation.

Copyright © 2026 Unity Technologies
법률 정보개인정보 처리방침쿠키Documentation Terms of Use개인 정보 판매 또는 공유 금지개인정보 보호 선택(쿠키 설정)

'Unity', Unity 로고 및 기타 Unity 상표는 미국 및 기타 지역 내 Unity Technologies 또는 그 계열사의 상표 또는 등록상표입니다(자세한 내용은 여기에서 확인하세요). 기타 명칭 또는 브랜드는 해당 소유자의 상표입니다.

일부 페이지는 편의를 위해 기계 번역되었으며 부정확한 내용이 있을 수 있습니다. 정보가 상충되는 경우, 영어 버전을 우선으로 참조하세요.

  • 보고 있는 페이지
    • Script implementation

      • Implementing the MREC banner format

    • Banner ad example


이 페이지의 문제 보고
​
​