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:

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Erel, I´m using the 1.0.2 version of iadmod and lastest sdk from google, I got this error when compiling, look:

Ld Payload/Youtube\ DL.app/Youtube\ DL normal arm64
cd /Users/iglesias/Development/B4i-MacServer/UploadedProjects/iglesias
export IPHONEOS_DEPLOYMENT_TARGET=7.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/iglesias/bin/Sencha/Cmd/3.1.0.192:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/Users/iglesias/Development/sdk/platform-tools:/Users/iglesias/Development/sdk/tools"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -L/Users/iglesias/Development/B4i-MacServer/UploadedProjects/iglesias/Payload -L../../Libs -F/Users/iglesias/Development/B4i-MacServer/UploadedProjects/iglesias/Payload -F../../Libs -filelist /Users/iglesias/Development/B4i-MacServer/UploadedProjects/iglesias/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/Youtube\ DL.LinkFileList -ObjC -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -lCore -framework Foundation -framework CoreGraphics -framework UIKit -liRandomAccessFile -liStringUtils -liHUD -liPhone -liMedia -liHttp -liNet -liSQL -liJSON -liAwesomeMenu -liActivityBar -liAdMob -framework AVFoundation -lz -framework MessageUI -framework CoreMotion -framework CFNetwork -lsqlite3 -framework AudioToolbox -framework AdSupport -framework CoreGraphics -framework CoreTelephony -framework EventKit -framework EventKitUI -framework StoreKit -framework SystemConfiguration -framework GoogleMobileAds -liDebug -Xlinker -dependency_info -Xlinker /Users/iglesias/Development/B4i-MacServer/UploadedProjects/iglesias/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/Youtube\ DL_dependency_info.dat -o /Users/iglesias/Development/B4i-MacServer/UploadedProjects/iglesias/Payload/Youtube\ DL.app/Youtube\ DL
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 (arm64): ../../Libs/GoogleMobileAds.framework/GoogleMobileAds
Undefined symbols for architecture arm64:
"_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 arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)



Do you know why?

Thanks

Alberto Iglesias
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Erel,

It´s working in almost all devices I have, but in Samsungs is something strange behavior:

I receive the event "ReceiveAd" but in screen not appear the ad! Strange this no? I tested in a samsung tablet, samsung S5 but not got any error and no ad visible.

And I colorize to blue to see where is the adview and is in the same place, I don´t know why not appear.

Do you have this problem before?

Thanks
 

sorex

Expert
Licensed User
Longtime User
Why do we need this testDevices command for the full size ads while the small banners work without it?
(altho it's just showing always the same Clash of Kings ad)

the logs also show this...

<Google:HTML> You are currently using version 7.2.2 of the SDK. Please consider updating your SDK to the most recent SDK version to get the latest features and bug fixes. The latest SDK can be downloaded from http://goo.gl/iGzfsP. A full list of release notes is available at https://developers.google.com/admob/ios/rel-notes.
 

ilan

Expert
Licensed User
Longtime User
what is the latest version for iAdmob? what i see it is version 1.21 but in my ide i see version 1.30
do i have a wrong lib?

when i try to show ads i get this error:

failed: Error Domain=com.google.ads Code=1 "Request Error: No ad to show." UserInfo=0x147b2d70 {NSLocalizedDescription=Request Error: No ad to show., NSLocalizedFailureReason=Request Error: No ad to show.}
 

sorex

Expert
Licensed User
Longtime User
I see 1.30 here, Ilan.

my guess is that the servers are overcrowded sometimes.

ads might not load and a few minutes later they do without touching the code.

this is on both android & ios happening.
 

abhishek007p

Active Member
Licensed User
Longtime User
i am currently using 1.21. i see the library update thread and 1.30 is available.
should i update to 1.30 or i am fine using 1.21 ? or if i use older version, my app might get rejected ?
 
D

Deleted member 103

Guest
Hi,

I have this error:
<Google:HTML> You are currently using version 7.7.0 of the SDK. Please consider updating your SDK to the most recent SDK version to get the latest features and bug fixes. The latest SDK can be downloaded from http://goo.gl/iGzfsP. A full list of release notes is available at https://developers.google.com/admob/ios/rel-notes.

and when I install the version 7.8.0 I have this error message:
...
...

"_OBJC_CLASS_$_SFSafariViewController", referenced from:
objc-class-ref in GoogleMobileAds(flat-armv7)
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/StopWatch4all-Lite.app/StopWatch4all-Lite normal armv7
(1 failure)
 
Status
Not open for further replies.
Top