광고 로드 오류

광고가 로드되지 못하면 LoadAdError 객체를 제공하는 콜백이 호출됩니다.

다음은 광고를 로드하지 못했을 때 제공되는 정보를 보여주는 예입니다.

Kotlin

override fun onAdFailedToLoad(adError: LoadAdError) {
  // Gets the error code. See
  // https://developers.google.com/admob/android/early-access/nextgen/reference/com/google/android/libraries/ads/mobile/sdk/common/LoadAdError.ErrorCode
  // for a list of possible codes.
  val errorCode = adError.code
  // Gets an error message.
  val errorMessage = adError.message
  // Gets additional response information about the request. See
  // https://developers.google.com/ad-manager/mobile-ads-sdk/android/beta/response-info
  // for more information.
  val responseInfo = adError.responseInfo
  // All of this information is available using the error's toString() method.
  Log.d("Ads", adError.toString())
}

Java

@Override
public void onAdFailedToLoad(@NonNull LoadAdError adError) {
  // Gets the error code. See
  // https://developers.google.com/admob/android/early-access/nextgen/reference/com/google/android/libraries/ads/mobile/sdk/common/LoadAdError.ErrorCode
  // for a list of possible codes.
  ErrorCode errorCode = adError.getCode();
  // Gets an error message.
  String errorMessage = adError.getMessage();
  // Gets additional response information about the request. See
  // https://developers.google.com/ad-manager/mobile-ads-sdk/android/beta/response-info
  // for more information.
  ResponseInfo responseInfo = adError.getResponseInfo();
  // All of this information is available using the error's toString() method.
  Log.d("Ads", adError.toString());
}