Error Pemuatan Iklan

Jika iklan gagal dimuat, callback kegagalan akan dipanggil yang menyediakan objek LoadAdError.

Cuplikan kode berikut mengambil informasi error saat iklan reward gagal dimuat:

onAdFailedToLoad: (ad, loadAdError) {
  // Gets the domain from which the error came.
  String domain = loadAdError.domain;

  // Gets the error code. See
  // https://developers.google.com/android/reference/com/google/android/gms/ads/AdRequest
  // and https://developers.google.com/admob/ios/api/reference/Enums/GADErrorCode
  // for a list of possible codes.
  int code = loadAdError.code;

  // A log friendly string summarizing the error.
  String message = loadAdError.message;

  // Get response information, which may include results of mediation requests.
  ResponseInfo? responseInfo = loadAdError.responseInfo;
}

Informasi ini dapat digunakan untuk menentukan secara lebih akurat penyebab kegagalan pemuatan iklan. Secara khusus, untuk error pada domain com.google.admob di iOS dan com.google.android.gms.ads di Android, GetMessage() dapat dicari di artikel pusat bantuan ini untuk mengetahui penjelasan yang lebih mendetail dan tindakan yang dapat dilakukan untuk menyelesaikan masalah tersebut.