광고 로드 오류

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

an AdManagerAdView의 경우 다음이 호출됩니다.

다음은 광고 로드에 실패할 때 사용할 수 있는 정보를 보여주는 코드 스니펫입니다.

자바

@Override
public void onAdFailedToLoad(LoadAdError error) {
  // Gets the domain from which the error came.
  String errorDomain = error.getDomain();
  // Gets the error code. See
  // https://developers.google.com/android/reference/com/google/android/gms/ads/AdRequest#constant-summary
  // for a list of possible codes.
  int errorCode = error.getCode();
  // Gets an error message.
  String errorMessage = error.getMessage();
  // Gets additional response information about the request. See
  // https://developers.google.com/admob/android/response-info for more
  // information.
  ResponseInfo responseInfo = error.getResponseInfo();
  // Gets the cause of the error, if available.
  AdError cause = error.getCause();
  // All of this information is available via the error's toString() method.
  Log.d("Ads", error.toString());
}

Kotlin

override fun onAdFailedToLoad(error: LoadAdError) {
    // Gets the domain from which the error came.
    val errorDomain = error.domain
    // Gets the error code. See
    // https://developers.google.com/android/reference/com/google/android/gms/ads/AdRequest#constant-summary
    // for a list of possible codes.
    val errorCode = error.code
    // Gets an error message.
    val errorMessage = error.message
    // Gets additional response information about the request. See
    // https://developers.google.com/admob/android/response-info for more
    // information.
    val responseInfo = error.responseInfo
    // Gets the cause of the error, if available.
    val cause = error.cause
    // All of this information is available via the error's toString() method.
    Log.d("Ads", error.toString())
}

이 정보를 사용하여 광고 로드 실패 원인을 더욱 정확하게 파악할 수 있습니다.