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#groovyInterstitial ads
https://developers.google.com/admob/android/interstitialAnd the included github repo
https://github.com/googleads/googleads-mobile-android-examples/tree/main/java/admob/InterstitialExampleHere 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-aQuestion 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.