خطاهای بارگذاری آگهی

وقتی تبلیغی بارگذاری نمی‌شود، همیشه یک علامت وجود دارد پاسخ به تماس که نامیده می شود که الف را فراهم می کند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());
}

کاتلین

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())
}

از این اطلاعات می توان برای تعیین دقیق تری استفاده کرد که چه چیزی باعث شکست بارگذاری تبلیغات شده است.