RoadMap : Admob, Getting Started > Android 요구사항 > Banners 2

Menus : 실습




안드로이드에 간단히 광고를 넣으려면 Banner 1 예제를 참고 하시면됩니다. 하지만, 더 자세한 컨트롤을 원하신다면, Banner 2  예제, 즉 본 예제를 참고 하시면됩니다. 언제나 항상 말씀드리지만, 번역이 이상할 경우 댓글 달아 주세요. (발 번역입니다. ㅠ,.ㅜ)





Banners II (배너 2)

In this guide, we show you more ways to control banner ad properties.
이 가이드 속에는 배너 속성을 조절하는 더 많은 방법를 보여줍니다.



iOS
Android
Windows Phone 7
  1. Banner Sizes
  2. Ad Refresh
  3. com.google.ads.AdRequest
    1. AdRequest.addTestDevice | AdRequest.setTestDevices
    2. Targeting
  4. com.google.ads.AdListener

Banner Sizes (배너 크기)

Google AdMob Ads supports three tablet-only banner sizes in addition to the 320x50 shown on phones:
구글 애드몹 광고는 3가지 태블릿 전용 배너사이즈와 추가된 320x50 크기의 광고가 폰에 보여지는 것을 지원 :


Size (WxH)DescriptionAvailabilityAdSize Constant
320x50Standard BannerPhones and TabletsBANNER
300x250IAB Medium RectangleTabletsIAB_MRECT
468x60IAB Full-Size BannerTabletsIAB_BANNER
728x90IAB LeaderboardTabletsIAB_LEADERBOARD
See tableSmart BannerPhones and TabletsSMART_BANNER

The SDK will request whatever size the requesting AdView was instantiated with. If there isn't enough space on the device's screen to display the ad, nothing will be shown.

SDK 는 AdView과 인스턴트화 되면 광고 사이즈 요청할 것을 요구할 것이다. 장치의 화면에 광고가 보여질 공간이 없다면, 광고가 보여지지 않을 것이다.

Ad Refresh (광고 리프레쉬)

Banners auto-refresh if a refresh rate has been specified in your AdMob account on the server and may be programmatically refreshed by loading a new request.
서버 애드몹 계정에 리프레쉬 값이 지정하면 자동 새로고침이 되고, 새 요청에 의한 로드로 프로그래밍 리프레쉬를 할 수있습니다.


com.google.ads.AdRequest

Before being passed to AdView.loadAd an AdRequest may be customized to allow Google to better target ads.
AdView.loadAd에 AdRequest가 전달 되기전에 더 좋은 타겟 광고를 허용하는 것을 선택 할 수 있습니다.


AdRequest.addTestDevice | AdRequest.setTestDevices

You can use these properties to to specify a device or Set of devices that will receive test ads. You should utilize this property during development to avoid generating false impressions. To verify that you've integrated the SDK correctly, add your test device, run your application, and click on the displayed test ad.
이러한 속성으로 장치나 장치들의 셋트를 지정할 수 있고, 지정된 장치들은 테스트 광고를 받을 수 있게 됩니다. 당신은 잘못된 (광고의)노출이 생기는 것을 피하기 위해 앞에서 말한 속성을 개발하는 동안 사용해야 합니다. 제대로된 통합된 SDK를 가지고 있는지, 테스트 장치를 추가했는지, 애플리케이션이 동작하는지, 표시된 광고위에 클릭 되는 것을 확인해야 합니다.


AdRequest request = new AdRequest();

request
.addTestDevice(AdRequest.TEST_EMULATOR);
request
.addTestDevice("E83D20734F72FB3108F104ABC0FFC738");    // My T-Mobile G1 test phone

logcat will print the device's MD5-hashed ID for convenience, for example: 
   To get test ads on this device, call adRequest.addTestDevice("E83D20734F72FB3108F104ABC0FFC738");
예제의 결과로, 로그켓에 장치의 MD5-hashed ID를 간편하게 출력할 것이다.
    '
adRequest.addTestDevice("E83D20734F72FB3108F104ABC0FFC738")'를 호출해서 이 장치 위에 테스트 광고를 가져 온다.

Targeting (광고를 볼 사람의 정보로 필요할 것 같은 광고를 찾는 것을 의미 합니다.)

Location and demographic targeting information may also be specified. Out of respect for user privacy, Google asks that you only specify location and demographic data if that information is already used by your app.
장소와 인구 통계학 등의 대상 정보 도 지정할 수 있습니다. 개인의 정보를 소중히 여기며, 구글은 오직 지정된 장소와 인구 통계학 데이터를 요청하며, 그것은 이미 앱에 사용된 정보들입니다.


AdRequest request = new AdRequest();

request
.setGender(AdRequest.Gender.FEMALE);
request
.setLocation(location);
request
.setBirthday("19850101");

where the user's location is obtained by a suitable method.
여기서 사용자의 위치는 적절한 방법으로 얻을 수 있습니다.

com.google.ads.AdListener

You may optionally track ad lifecycle events like request failures or "click-through" by implementing com.google.ads.AdListener in an object you pass to AdView.setAdListener.
당신은 당신이 AdView.setAdListener에 전달한 객체 속 구현된 com.google.ads.AdListener를 통해 요청실패 또는 클릭을 통한 이벤트의 광고수명주기를 선택적으로 추적할 수 있습니다.

public interface AdListener {
 
public void onReceiveAd(Ad ad);
 
public void onFailedToReceiveAd(Ad ad, AdRequest.ErrorCode error);
 
public void onPresentScreen(Ad ad);
 
public void onDismissScreen(Ad ad);
 
public void onLeaveApplication(Ad ad);
}

This interface may be implemented by your activity or any other object:
이 인터페이스는 activity 또는 다른 객체에 구현 될 수 있습니다.

import com.google.ads.*;

public class BannerExample extends Activity implements AdListener {
}

and then passed to the Ad:
그리고 광고가 전달될 때 :

adView.setAdListener(this);
public void onReceiveAd(Ad ad)
Sent when AdView.loadAd has succeeded.
AdView.loadAd가 성공했을 때, 전송 (불러집니다.)

public void onFailedToReceiveAd(Ad ad, AdRequest.ErrorCode error)
Sent when loadAd has failed, typically because of network failure, an application configuration error, or a lack of ad inventory. You may wish to log these events for debugging:

loadAd가 실패했을 때, 일반적인 네트워크 실패, 애플리케이션 구성 오류, 또는 광고 인벤토리가 부족할 때  불려집니다. 당신은 디버깅을 위해 이러한 이벤트 기록을 원할 수 있을 것이다 :

@Override
public void onFailedToReceiveAd(Ad ad, AdRequest.ErrorCode errorCode) {
 
Log.d(MY_LOG_TAG, "failed to receive ad (" + errorCode + ")");
}
public void onPresentScreen(Ad ad)
Called when an Activity is created in front of your app, presenting the user with a full-screen ad UI in response to their touching ad.
당신의 앱 속에 액티비티가 생성된 뒤, 터치 광고의 응답에 풀스크린 광고가 사용자에게 보여질 때 불리어 집니다.


public void onDismissScreen(Ad ad)
Called when the full-screen Activity presented with onPresentScreen has been dismissed and control is returning to your app.
전체화면 액티비티에 onPresentScreen이 기각(실행되지 않음) 되어, 컨트롤이 당신의 앱으로 되돌아 갈 때 불리어 집니다.


public void onLeaveApplication(Ad ad)
Called when an Ad touch will launch a new application.
광고 터치로 새 앱이 시작될 것이며, 그때 호출됩니다.

You can download an example project containing a sample AdListener here.
다은은 샘플 AdListener가 포함된 예제 프로젝트를 여기서 다운로드 할 수 있습니다.

Posted by 창업자닉군
,