যখন একটি বিজ্ঞাপন লোড হতে ব্যর্থ হয়, সেখানে সর্বদা একটি কলব্যাক বলা হয় যা একটিLoadAdError
অবজেক্ট প্রদান করে।
an AdView
এর জন্য, নিম্নলিখিতটিকে বলা হয়:
জাভা
public void onAdFailedToLoad(LoadAdError adError);
কোটলিন
fun onAdFailedToLoad(error: LoadAdError)
এখানে একটি কোড স্নিপেট রয়েছে যা একটি বিজ্ঞাপন লোড হতে ব্যর্থ হলে উপলব্ধ তথ্য তুলে ধরে:
জাভা
@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()); }
কোটলিন
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
ডোমেনের অধীনে ত্রুটির জন্য, বার্তা এই সহায়তা কেন্দ্রের নিবন্ধে দেখা যেতে পারে এবং আরও বিস্তারিত ক্রিয়াকলাপ ব্যাখ্যা করতে পারে। সমস্যা সমাধানের জন্য নেওয়া হয়েছে।