Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Some questions for first time setup and use of admob.

32 views
Skip to first unread message

mikael diy

unread,
Jan 20, 2025, 1:11:33 AMJan 20
to Google Mobile Ads SDK Developers
Hi. This is he first time I set up AdMob for Android application. I have followed the following guide and sections.

https://developers.google.com/admob/android/quick-start#groovy
Interstitial ads
https://developers.google.com/admob/android/interstitial
And the included github repo
https://github.com/googleads/googleads-mobile-android-examples/tree/main/java/admob/InterstitialExample

Here is some explanation of how I have set it up and the questions.

I have added the test app_id in Android.manifest.xml provided by Android docs for

<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713"/>



and for adUnitId (adUnitId == ca-app-pub-3940256099942544~3347511712)

InterstitialAd.load(
    @NonNull android.content.Context context,
    @NonNull String adUnitId,
    @NonNull com.google.android.gms.ads.AdRequest adRequest,
    @NonNull com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback loadCallback
)


and TEST_DEVICE_HASHED_ID = "adb-xxxxxxxxxx._ad" (debug device id)

and full flow is working fine when testing to run app.

Question 1: Is there a reason in the demo that there is 2 different app_id used, one in androidManifest and one for InterstitialAd.load(....)-function, I tried to have both as ....712 and both as ....713 but it did not work?

Question 2: TEST_DEVICE_HASHED_ID is used to set up the ConsentDebugSettings that is used in consentInformation.requestConsentInfoUpdate(...) for when using my own testdevice (my own samsung-phone). I wonder how this need to be changed on publishing this to "prod"? Do i need to replace the debugSettings and config to a prod setting/config?

Question 3: The consentframe that appear on loading Before the ad-content comes up, I read that it is created based on settings that i need to setup in adMob (gdpr/etc), so unless I do not set this up the app will not work when I setup my own app_id?
messagehttps://stackoverflow.com/questions/68457966/failed-to-read-publishers-account-configuration-please-check-your-configured-a

Question 4: When testing to run app in debugmode it throws and exception that is caugh.
GoogleMobileAdsConsentManager#gatherConsent(....) is called from MyApplication

googleMobileAdsConsentManager.gatherConsent(
        this,
        consentError -> {
          if (consentError != null) {
            // Consent not obtained in current session.
          }
          if (googleMobileAdsConsentManager.canRequestAds()) { ..... }
          if (googleMobileAdsConsentManager.isPrivacyOptionsRequired()) { .... }
        });


in gatherConsent#consentInformation.requestConsentInfoUpdate(...) a formError is returned. The formError has null value. And when returned to MyApplication#gatherConsent(....) there is a error-check for handling when not being null. Functionwise it works fine. But not sure why the formerror is returned?
if (consentError != null) {
            // Consent not obtained in current session.
}


public void gatherConsent(
    .......................
    consentInformation.requestConsentInfoUpdate(
        activity,
        params,
        () ->
            UserMessagingPlatform.loadAndShowConsentFormIfRequired(
                activity,
                formError -> {
                  // Consent has been gathered.
                  onConsentGatheringCompleteListener.consentGatheringComplete(formError);
                }),
        ..............
  }


Thanks /Micke!

Now I belive this steps are left before app is up on Play!

What is left….

Generate a prod application id by adding the unpublished app to adMob account that I have created.
Changing the app_id for meta-data in app from adMob account and also change it InterstitialAd-load function.
Publish to google play.




Mobile Ads SDK Forum Advisor

unread,
Jan 20, 2025, 6:46:29 AMJan 20
to diyfo...@gmail.com, google-adm...@googlegroups.com

Hi Micke,

Thank you for contacting us.

Please find the answers below for your queries:

  • Question 1: Is there a reason in the demo that there is 2 different app_id used, one in androidManifest and one for InterstitialAd.load(....)-function, I tried to have both as ....712 and both as ....713 but it did not work?
    •  App ID and Ad unit ID are different and the ID that goes in Android.manifest.xml is App ID and the ID that goes in InterstitialAd.load(....)-function is ad unit ID. 
      • Sample app ID: ca-app-pub-3940256099942544~3347511713
      • Sample Interstitial ad unit ID: ca-app-pub-3940256099942544/1033173712
  • Question 2: TEST_DEVICE_HASHED_ID is used to set up the ConsentDebugSettings that is used in consentInformation.requestConsentInfoUpdate(...) for when using my own testdevice (my own samsung-phone). I wonder how this need to be changed on publishing this to "prod"? Do i need to replace the debugSettings and config to a prod setting/config?
    •  This TEST_DEVICE_HASHED_ID is used during development so that you can click on them without charging Google advertisers. This is used only for testing purpose meaning this does not apply for live or prod. Be sure to remove the code that sets these test device IDs before you release your app.
      •   // "Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("ABCDEF012345"))
      •   // to get test ads on this device" or
      •   // "Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("ABCDEF012345") to set this as
      •   // a debug device".
      •   public static final String TEST_DEVICE_HASHED_ID = "ABCDEF012345";
  • Question 3: The consentframe that appear on loading Before the ad-content comes up, I read that it is created based on settings that i need to setup in adMob (gdpr/etc), so unless I do not set this up the app will not work when I setup my own app_id messagehttps://stackoverflow.com/questions/68457966/failed-to-read-publishers-account-configuration-please-check-your-configured-a 
    • The app works fine even without consent. If users choose to not consent at all, then the ads that will display will be non-personalized ads.
  • Question 4: FormError is returned
    • Check the Github examples as a reference for your implementation. If the mentioned issue is replicating in Github samples, Kindly provide us with the sample project privately for further investigation. 
Yes, the steps you have mentioned left before app is on play are correct. 

You can provide the following details via reply privately to the author option or this link

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

Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5



mikael diy

unread,
Jan 20, 2025, 12:57:23 PMJan 20
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com

Hi. Thanks for response. I will look closer and comtact you later

Mobile Ads SDK Forum Advisor

unread,
Jan 21, 2025, 1:57:54 AMJan 21
to diyfo...@gmail.com, google-adm...@googlegroups.com

Hi Micke,

Thank you for sending the screenshot of the code snippet.

For the TEST_DEVICE_HASHED_ID, Add your test device in the AdMob UI. You can add the test device programmatically also like below:

List<String>
testDeviceIds=Arrays.asList("33BE2250B43518CCDA7DE426D04EE231");
RequestConfigurationconfiguration=new RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build();
MobileAds.setRequestConfiguration(configuration);

For a consent error, I would recommend comparing your gatherConsent fun with the Google sample project, especially GoogleMobileAdsConsentManager.kt file.  If this doesn't work kindly provide us with the sample project as requested earlier so that we can check, debug and may provide the solution.


 
You can provide the following details via reply privately to the author option or this link

Mobile Ads SDK Forum Advisor

unread,
Jan 22, 2025, 12:22:41 AMJan 22
to diyfo...@gmail.com, google-adm...@googlegroups.com

Hi, 

Thank you for getting back to us.

An app ID is the unique ID number assigned to your apps when they're added to AdMob. The app ID is used to identify your apps. Make sure you replace the test IDs with your own IDs before publishing your app. For more information, kindly refer to the Find an app ID

Please be informed that our team is only able to provide support via email. We highly appreciate your understanding on this matter. 

If you encounter any issues, feel free to reach out to us via email. 

Reply all
Reply to author
Forward
0 new messages