Reklam yükleme hataları


AdResult nesneleri, reklam yükleme girişimlerinin başarısız olduğunu tespit etme mekanizması sağlar. Bir hata oluşursa AdResult yöntemi is_successful() yanlış değerini döndürür. Bu gibi durumlarda, AdResult yöntemi ad_error() çağrıldığında hatayla ilgili bilgileri içeren bir AdError nesnesi döndürülür.

Aşağıda, bir reklam yüklenemediğinde kullanılabilen bilgileri gösteren bir kod snippet'i verilmiştir:

firebase::Future<firebase::gma::AdResult> load_ad_future =
  ad_view->LoadAd(request);

// In a game loop, monitor the load ad status
if (load_ad_future.status() == firebase::kFutureStatusComplete) {
  const firebase::gma::AdResult* ad_result = load_ad_future.result();
  if (!ad_result.is_successful()) {
    // There was an error loading the ad.
    const AdError& ad_error = ad_result.ad_error();
    firebase::gma::AdErrorCode code = ad_error.code();
    std::string domain = ad_error.domain();
    std::string message = ad_error.message();
    const firebase::gma::ResponseInfo response_info = ad_error.response_info();
    printf("Received error with domain: %s, code: %d, message: %s and response info: %s\n”,