Stay organized with collections
Save and categorize content based on your preferences.
AdResult objects provide a mechanism to detect failed attempts to load an ad.
If a failure occurs, the AdResult method is_successful() will return false.
In these situations, invoking the AdResult method ad_error() will return an
AdError object with information pertaining to the error.
Here is a code snippet that illustrates the information available when an ad
fails to load:
firebase::Future<firebase::gma::AdResult>load_ad_future=ad_view->LoadAd(request);// In a game loop, monitor the load ad statusif(load_ad_future.status()==firebase::kFutureStatusComplete){constfirebase::gma::AdResult*ad_result=load_ad_future.result();if(!ad_result.is_successful()){// There was an error loading the ad.constAdError&ad_error=ad_result.ad_error();firebase::gma::AdErrorCodecode=ad_error.code();std::stringdomain=ad_error.domain();std::stringmessage=ad_error.message();constfirebase::gma::ResponseInforesponse_info=ad_error.response_info();printf("Received error with domain: %s, code: %d, message: %s and response info: %s\n”,domain.c_str(),message.c_str(),response_info.ToString().c_str());}}
This information can be used to more accurately determine what caused the ad
load to fail. In particular, for errors under the domain com.google.admob on
iOS and com.google.android.gms.ads on Android, the message can be looked up in
this help center article for a more
detailed explanation and possible actions that can be taken to resolve the
issue.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-03 UTC."],[[["The Google Mobile Ads C++ SDK is deprecated and will be end-of-maintenance on June 17, 2025, with iOS and Android SDKs recommended as alternatives."],["Developers should use `AdResult` objects, specifically the `is_successful()` and `ad_error()` methods, to detect and diagnose ad loading failures."],["`AdError` objects provide detailed error information, including domain, code, and message, for troubleshooting failed ad loads."],["Error messages can be cross-referenced with the Google AdMob help center to identify the root cause and potential solutions."]]],[]]