B4A Library AdMob library

This library requires some configuration. Please see the tutorial: http://www.b4x.com/forum/basic4andr...-admob-tutorial-add-ads-your-application.html

Reference: Basic4android - AdMob

AdMob v2.00 - Based on Google Play Services. This version requires B4A v3.20.

AdMob v1.40 - Add support for SIZE_SMART_BANNER.
These ads will fill the whole available width: https://developers.google.com/mobile-ads-sdk/docs/admob/smart-banners

You can use the following code:
B4X:
Adview1.Initialize2("Ad", "xxxxxxxx", AdView1.SIZE_SMART_BANNER)
Dim height As Int
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
   'phones
   If 100%x > 100%y Then height = 32dip Else height = 50dip
Else
   'tablets
   height = 90dip
End If
Activity.AddView(AdView1, 0dip, 100%y - height, 100%x, height)

See this post for an additional requirement if using google play services v28: https://www.b4x.com/android/forum/threads/admob-library.7301/page-10#post-381519
 

Attachments

  • AdMob_old.zip
    4.3 KB · Views: 974
  • AdMob.zip
    4.7 KB · Views: 2,858
Last edited:

GMan

Well-Known Member
Licensed User
Longtime User
Dont know what will happen, thats AdMobs "thing" ;)
LeadBolt has a better payout as AdMob, MUCH more banners and interstitials (these are great) :D AND are looking better then AdMob

And the normal banner (as AdMob) is AutoStretching - so never more problems with setting width etc. :rolleyes:

See these 2 pics of the GUI as an example:
leadbolt1.png

leadbolt2.png
 

tuhatinhvn

Active Member
Licensed User
Longtime User
Why size is very lager?
Can i remove google play service with phone have it?

I see many app with new admob have little size.
 

aeropic

Active Member
Licensed User
Longtime User
Try this: open google-play-services.jar with a tool such as 7zip.

Delete all the folders selected in this screenshot:


If you are using google-play-services with other libraries as well (such as GoogleMaps) then you will need to keep some of the classes.

In that case only delete the internal folder which is the largest one.

Hi Erel,
Humm, I tried both options (all and only the big folder) ==> it fails :(
 

aeropic

Active Member
Licensed User
Longtime User
You are correct. It is not possible to reduce the library size. I've deleted my previous post.

With a trail and fail method I ended with this content of the librairy which apparently seems to work...
playserviceslight.jpg

At least it displays:
- smart banners
- interstitial ads
I've not checked if a click is correctly attributed to my account ...
The impact on the memory footprint is in the range of 300kB
I did not try to open "internal" folder and do some gardening insisde !
==> not sure it worths to do this !!!
 

ilan

Expert
Licensed User
Longtime User
does the new library requiers a minimum version of android?
i have only now noticed that all my apps that i have updated to the latest admob library dont work on android 2.3.5

what do i need to write in the manifest to disable old versions of android? minSDK? (what is the min SDK for android 4+?)
 

GMan

Well-Known Member
Licensed User
Longtime User
This describes the Min/Max-Version:
B4X:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="19"/>
 

GMan

Well-Known Member
Licensed User
Longtime User
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/> ?
 

GMan

Well-Known Member
Licensed User
Longtime User
As in the Tut is written:
AdMob library requires Android SDK level 13 or above.
 

ilan

Expert
Licensed User
Longtime User
i missed that thanx a lot

what happens now if people have installed old version on android 2.3.4 and now i change the min SDK do they will get an update message?
 

GMan

Well-Known Member
Licensed User
Longtime User
i think that it will not work, but Erel is our B4A-Prof :)
 

ilan

Expert
Licensed User
Longtime User
now i understand why i get in the last weeks some 1* ratings... sh**t

thanx for your help GMan :)
 

ilan

Expert
Licensed User
Longtime User
ok thanx erel, but after i updated my apps with the new admob 2.0 lib it wont run on android 2.3.5

the min sdk was 4 but it should run anyway on those devices right? (android 2.3+ also if the min SDK was set to 4)
so why does my apps crash immidiatly on start and without admob 2.0 it runs without any problems??

could it be the Admob INterstitial Lib from Jack cole?? http://www.b4x.com/android/forum/threads/admob-interstitial-library-beta.32891/
 
Top