B4i Library iAdMob

Status
Not open for further replies.
Latest version: https://www.b4x.com/android/forum/threads/firebase-admob-v3-00.144798/#content

iAdMob v1.10 adds support for interstitial ads (full screen ads).

In order to show an interstitial ad you need to first request an ad and wait for the Ready event.
If Success is true then there is an ad ready to be displayed. You can then call iad.Show(Page) to show it.
You can also call iad.RequestAd again to request a new ad.

Note that you can show test ads by calling:
B4X:
iad.SetTestDevices(Array("121212121212")) 'id that is displayed in the logs
The ready event:
B4X:
Sub iad_Ready (Success As Boolean)
   If Success Then
     Log("iad is ready.")
     iad.Show(Page1)
   Else
     Log("Failed to load full screen ad: " & LastException)
   End If
End Sub

Note that you can show the ad after this event. This event only means that there is an ad ready to be displayed.

Library installation

iAdMob is an internal library now. It is preinstalled with the IDE.

If you are using a local Mac builder you need to download the new SDK and copy GoogleMobileAds.framework to the Libs folder: www.b4x.com/b4i/files/libGoogleAdMobAds.a.zip

Update:

Starting from Google Maps Ads SDK v7.42.0 it is required to add these lines:
B4X:
#PlistExtra: <key>GADIsAdManagerApp</key><true/>
#AdditionalLib: libsqlite3.dylib
#AdditionalLib: libz.dylib
#AdditionalLib: WebKit.framework
 
Last edited:

fishwolf

Well-Known Member
Licensed User
Longtime User
Sorry, last question :)

can i capture the interstitial event, in particular a event when the intestitial is closed or go to in timeout ?
 

fishwolf

Well-Known Member
Licensed User
Longtime User
Some interstitial cannot be close, if i click on "x" icon, doesn't close.
Why?
 

ilan

Expert
Licensed User
Longtime User
Some interstitial cannot be close, if i click on "x" icon, doesn't close.
Why?

are u trying it in debug mode? sometimes it happend to me too but i think its only taking a little bit more to load the ad and after about 3-4 sec the x button works again

i had now issue in release mode ..
 

quimacama

Member
Licensed User
Longtime User

Pendrush

Well-Known Member
Licensed User
Longtime User
Can you update iAdMOb SDK in libGoogleAdMobAds.a
Message from log
<Google:HTML> You are currently using version 6.12.2 of the SDK, which doesn't officially support iOS 8. Please consider updating your SDK to the most recent sdk version, 7.0.0, to get iOS 8 support, including a fix for smart banner rendering in landscape mode. The latest SDK can be downloaded from http://goo.gl/iGzfsP. A full list of release notes is available at https://developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes.
 

Hypnos

Active Member
Licensed User
Longtime User
Hi Erel,

I can't find the .xml file from the zip file (library 1.20) in #1 ?
 

Pendrush

Well-Known Member
Licensed User
Longtime User
on local mac builder i get this error
ld: warning: ignoring file ../../Libs/GoogleMobileAds.framework/GoogleMobileAds, file was built for unsupported file format ( 0x56 0x65 0x72 0x73 0x69 0x6F 0x6E 0x73 0x2F 0x43 0x75 0x72 0x72 0x65 0x6E 0x74 ) which is not the architecture being linked (armv7): ../../Libs/GoogleMobileAds.framework/GoogleMobileAds
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GADBannerView", referenced from:
objc-class-ref in libiAdMob.a(B4IAdView.o)
"_OBJC_CLASS_$_GADInterstitial", referenced from:
objc-class-ref in libiAdMob.a(B4IAdView.o)
"_OBJC_CLASS_$_GADRequest", referenced from:
objc-class-ref in libiAdMob.a(B4IAdView.o)
"_kGADAdSizeBanner", referenced from:
-[B4IAdView SIZE_BANNER] in libiAdMob.a(B4IAdView.o)
"_kGADAdSizeFullBanner", referenced from:
-[B4IAdView SIZE_FULL_BANNER] in libiAdMob.a(B4IAdView.o)
"_kGADAdSizeLargeBanner", referenced from:
-[B4IAdView SIZE_LARGE_BANNER] in libiAdMob.a(B4IAdView.o)
"_kGADAdSizeLeaderboard", referenced from:
-[B4IAdView SIZE_LEADERBOARD] in libiAdMob.a(B4IAdView.o)
"_kGADAdSizeSmartBannerLandscape", referenced from:
-[B4IAdView SIZE_SMART_BANNER_LANDSCAPE] in libiAdMob.a(B4IAdView.o)
"_kGADAdSizeSmartBannerPortrait", referenced from:
-[B4IAdView SIZE_SMART_BANNER_PORTRAIT] in libiAdMob.a(B4IAdView.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Error: ** BUILD FAILED **


The following build commands failed:
Ld Payload/xxxx.app/xxxx normal armv7
(1 failure)

When I copy file from \b4iBuild\Libs\GoogleMobileAds.framework\Versions\A\GoogleMobileAds to \b4iBuild\Libs\GoogleMobileAds.framework\ and overwrite file with same name (file on second path have this content "Versions/Current/GoogleMobileAds") and 32 bytes in size, my build is success.
I'm unable to make it compile in other way.
Is this OK?
 
Status
Not open for further replies.
Top