AdMob Error - HTTP Response Code: 403

56 views
Skip to first unread message

Arjun Singh

unread,
Nov 21, 2024, 5:39:57 PM (8 days ago) Nov 21
to Google Mobile Ads SDK Developers
Dear Google AdMob Support Team,
I am encountering an issue with the Google Mobile Ads SDK in my Android application. The error details are as follows
{
"Code": 3,
 "Message": "Received error HTTP response code: 403",
"Domain": "com.google.android.gms.ads",
 "Cause": "null",
"Response Info": {
    "Response ID": "null",
     Mediation Adapter Class Name": "",
      "Adapter Responses": [],
       "Response Extras": {}
   }
}

Could you please assist in diagnosing the root cause and provide guidance to resolve this issue?

App-Unit Id=ca-app-pub-6563898924587043~2434028627
Banner Id =ca-app-pub-6563898924587043/4327363094


Regarding 
Arjun Singh


Mobile Ads SDK Forum Advisor

unread,
Nov 21, 2024, 8:20:06 PM (8 days ago) Nov 21
to arjun...@gmail.com, google-adm...@googlegroups.com

Hi Arjun Singh,


I ran our Google Sample Application with the provided app ID and ad unit ID and I am unable to load the ads on my end. It has come to my attention that the error message "no fill" is being displayed in conjunction with your IDs. The “no fill” error means an ad serving issue which indicates there are no ads available at request time. This is more of an Ad serving concern rather than anything specific to the code implementation of the Mobile Ads SDK. The next step for you would be to reach out to the Product support team for further assistance regarding the ad serving concern. The Product Support Team is well equipped to handle your concern effectively.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vGlTl:ref" (ADR-00276363)

Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5



Arjun Singh

unread,
Nov 22, 2024, 11:09:58 PM (7 days ago) Nov 22
to Google Mobile Ads SDK Developers
Dear Google AdMob Support Team,


private val isMobileAdsInitializeCalled = AtomicBoolean(false)

private var adView: AdView? = null

private lateinit var googleMobileAdsConsentManager: GoogleMobileAdsConsentManager

              


   googleMobileAdsConsentManager =

                  GoogleMobileAdsConsentManager.getInstance(applicationContext)

googleMobileAdsConsentManager.isDebugMode = false

googleMobileAdsConsentManager.gatherConsent(this) { error ->

Log.e(TAG, "" + error.toString());

if (error != null) {

// Log error details

Log.e(

TAG,

"Consent error: Code = ${error.errorCode}, Message = ${error.message}"

)

} else {

Log.d(TAG, "Consent successfully gathered.")

}

Log.d(TAG, "Can request ads: ${googleMobileAdsConsentManager.canRequestAds}")

if (googleMobileAdsConsentManager.canRequestAds) {

initializeMobileAdsSdk()

}

Log.d(

TAG,

"Is privacy options required: ${googleMobileAdsConsentManager.isPrivacyOptionsRequired}"

)

if (googleMobileAdsConsentManager.isPrivacyOptionsRequired) {

invalidateOptionsMenu()

Log.d(TAG, "Privacy options menu invalidated.")

     }

}



private val adSize: AdSize

    get() {

        val displayMetrics = resources.displayMetrics

        val adWidthPixels =

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {

                val windowMetrics: WindowMetrics = this.windowManager.currentWindowMetrics

                windowMetrics.bounds.width()

            } else {

                displayMetrics.widthPixels

            }

        val density = displayMetrics.density

        val adWidth = (adWidthPixels / density).toInt()

        return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(this, adWidth)

    }

/** Called when leaving the activity. */

public override fun onPause() {

    adView?.pause()

    super.onPause()

}

/** Called when returning to the activity. */

public override fun onResume() {

    super.onResume()

    adView?.resume()

}

/** Called before the activity is destroyed. */

public override fun onDestroy() {

    adView?.destroy()

    super.onDestroy()

}

private fun loadBanner() {

   

    val adView = AdView(this)

    adView.adUnitId = getString(R.string.admob_add_banners_id)

    adView.setAdSize(adSize)

    this.adView = adView

    // Replace ad container with new ad view.

    binding!!.adViewContainer.removeAllViews()

    binding!!.adViewContainer.addView(adView)

    // [END create_ad_view]

    val adRequest: AdRequest = AdRequest.Builder()

        .build()

    adView.loadAd(adRequest)

}

// [START request_ads]

private fun initializeMobileAdsSdk() {

    if (isMobileAdsInitializeCalled.getAndSet(true)) {

        return

    }

    // [END_EXCLUDE]

    CoroutineScope(Dispatchers.IO).launch {

        // Initialize the Google Mobile Ads SDK on a background thread.

        MobileAds.initialize(this) {

        }

        runOnUiThread {

            // Load an ad on the main thread.

            loadBanner()

        }

    }

}

I am currently experiencing an issue where ads are not displaying in my Android app's release build, despite being correctly configured in the development environment. I have followed the necessary steps to initialize the Mobile Ads SDK, gather consent, and request ads. However, the ads are not appearing in the release version of the app.

Details:
  • App Name: Spirals Health
  • Ad Unit IDs:
    • App Id : ca-app-pub-6563898924587043~2434028627
    • Banner Ad Unit: ca-app-pub-6563898924587043/4327363094
  • App Version: 2.0.67
  • Issue: Ads not displaying in the release build.
  • Testing Environment: Ads are displaying fine in debug mode and the emulator.
  • Consent Manager: I am using the Google Mobile Ads Consent SDK, and the consent flow is working correctly. Consent has been gathered and is being checked.
  • Logs:
    • Consent has been successfully gathered with Can request ads: true status.
    • No errors are being thrown in the logs related to the ad requests.
Steps Taken:
  1. Initialized Google Mobile Ads SDK properly.
  2. Gathered consent using the Consent SDK.
  3. Checked the ad unit IDs, and they are correct.
  4. Set up ad requests using AdRequest.Builder().
  5. Ensured that the device is compatible, and ads should be available in the current region.
Request:

I would appreciate your assistance in investigating why ads are not being served in the release build. Could you please provide any insights or additional steps I can take to resolve this issue?

Thank you for your help!

Arjun Singh



Mobile Ads SDK Forum Advisor

unread,
Nov 23, 2024, 2:35:20 AM (7 days ago) Nov 23
to arjun...@gmail.com, google-adm...@googlegroups.com

Hi Arjun Singh,

Thank you for getting back to us.

I'm deleting the previous thread from the forum as it consists of PII information (app ID: ca-app-pub-656XXXXXXXXX43~24XXXXXX27 and ad unit ID: ca-app-pub-65XXXXXX43/43XXX94).

Please note that Received error HTTP response code: 403 means, AdMob servers rejected the request. Could you try again later? If consistently reproducible, capture the request URL using ad inspector and contact the Product Support Team as they are better equipped to address your concern and provide further assistance.  

Reply all
Reply to author
Forward
0 new messages