विज्ञापन लोड करने से जुड़ी गड़बड़ियां

जब कोई विज्ञापन लोड नहीं हो पाता, तो हमेशा कॉलबैक को कहा जाता है, जो LoadAdError ऑब्जेक्ट देता है.

an AdViewके लिए, इन्हें कॉल किया जाता है:

यहां एक कोड स्निपेट दिया गया है, जो विज्ञापन के लोड होने में उपलब्ध जानकारी दिखाता है:

Java

@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.
  // For example "Account not approved yet". See
  // https://support.google.com/admob/answer/9905175 for explanations of
  // common errors.
  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.
    // For example "Account not approved yet". See
    // https://support.google.com/admob/answer/9905175 for explanations of
    // common errors.
    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())
}

इस जानकारी का इस्तेमाल ज़्यादा सटीक तरीके से यह तय करने के लिए किया जा सकता है कि विज्ञापन क्यों लोड नहीं हुआ. खास तौर पर, MobileAds.ERROR_DOMAIN डोमेन में होने वाली गड़बड़ियों को सहायता केंद्र के इस लेख में देखा जा सकता है. यहां समस्या को हल करने के बारे में ज़्यादा जानकारी और कार्रवाई की जा सकती है.