Android Question AdMob Setup

ac9ts

Active Member
Licensed User
Longtime User
I believe I have AdMob setup properly in my code but I am unsure on the sequence of events required to get it all working. What I've done is:

1) Fully debugged my app with the AdMob code installed. It displays in the emulator so I assume it works.
2) Published the app in the PlayStore.
3) Logged into AdMob and looked for my app so I can get the Ad Unit ID.

As it can take a long (LONG) time for the app to show up at AdMob, I am guessing at the remaining steps.

4) Add the Ad Unit ID to the app and update it in the PlayStore.

If this is correct, it would seem that any app that used AdMob will have at least 2 releases (step 2 and 4). It would also seem that, in theory, somebody could download the app prior to it having the correct Ad Unit ID and have an Ad-Free version if they choose not to update.

Is this the correct way to do it or is there some other tutorial that I haven't found?
 

mlc

Active Member
Licensed User
Longtime User
Hello,
First you create the app in Admob, so you get the ID. Use the same name as the app will.
Configure your app with admob id and then publish it in Google.play.

Finally, in the Admob console, you match, the admob app with google.play app.
It may take a few days to show your app in the list (to match).
Regards
 
Upvote 0

eps

Expert
Licensed User
Longtime User
You don't need to place it in the Play Store for the Ad to work. I've got an App that's still in development, with an App Id, but not on the Play Store.

If you are new to Admob then it can take some time initially, but once set up and working then adding further Apps should be working within an hour or so.

Have you seen this? http://www.b4x.com/android/forum/threads/admob-tutorial-add-ads-to-your-application.7300/

Most of the above should still ring true. It's been a long time since I've been through that tutorial.
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
I did get an App ID a few days ago by manually entering a name but the the adds don't show on my device. I put in the Application Label for the name. Should I have put in the package name (which seems to make more sense)? I'm also a first-time user so it will probably take awhile for the app to show and start sending ads to me during debug..
 
Last edited:
Upvote 0

eps

Expert
Licensed User
Longtime User
Are you seeing any ad activity? What does the admob area indicate when you log in? It usually informs you that an advert is live, but not yet responding, etc.. or something like that. You might need to verify your address and account and so on.
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
I have yet to see anything on the device. I was playing with this yesterday and used the the application label for the name when I got the Ad ID. The logs showed error 4 (network error?) during testing and would repeat somewhat regularly. The AdMob status page show 37 "impressions" with a 100% fill rate.

I generated another Ad ID but used the package name this time. I replaced the Ad ID and the log shows error 0 once and no other errors are displayed. I'm not sure what error 0 is. I'll have to try and find where I saw the error codes. Even with the different error, the ads are not being displayed.

I am testing on a rooted device and I don't think there is an ad-block running as I see ads on other apps. I'll have to check tomorrow at AdMob to see what the fill rate is. I am a new user so maybe I need to wait longer for things to get moving.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
If you are seeing 37 impressions then that means it's working, maybe the advert isn't being displayed or is hidden behind something? I guess you're the only one that is using the App at the moment, so the impressions can only have come from you?

Your manifest file is set up correctly, etc..?
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
Added to the end of the manifest
B4X:
'AdMob
AddApplicationText(
<meta-data android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
)
'End of AdMob

And the code to load. I set the background to gray so I can see where the view is for testing.

B4X:
Adview1.Initialize("Ad", "ca-app-pub-1111111111111111/2222222222")
    Activity.AddView(Adview1, 50%x-160dip, 0dip, 320dip, 50dip)
      Adview1.LoadAd
    Adview1.BringToFront
    Adview1.Color = Colors.DarkGray

I'm using AdMob lib v2.00 and SDK 13 to compile.
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
Another question, when manually generating an Ad ID, what should the name be? The Application Label or the Package Name?
 
Upvote 0

eps

Expert
Licensed User
Longtime User
I don't know I just pick up the ad id that Admob gives.

I use the following code :

B4X:
   AdView1.Initialize2("Ad", "insertadmobidhere", AdView1.SIZE_SMART_BANNER)

Try this. You don't need to worry about resizing the view then, it will fill the view.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
and I use this after the initialise

B4X:
    Activity.AddView(AdView1, 0dip, ScreenHeight, 100%x, 50dip) 'previously the height was 48dip. Now it is 50dip

    AdView1.LoadAd 'loads an ad

My advert goes at the bottom, so Screenheight is set before this to 100%y-50dip or something along those lines
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
Well.....It seems that my code does work. I finally got around to checking on my tablet (Android 4.1.1) and the ads are displaying. The log file confirms it as well. My phone (v2.3.5, don't judge. I like my phone and the way it's set up), must have either an ad block that I don't know about or some other setting that blocks the ads.

Anyway, thank you EPS for all your advice and I apologize for the run-around.
 
Upvote 0
Top