iOS Question iAdMob Adview

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi everybody! I'm trying to enable adview on my app, but i don't understand 2 things.

A) Is there a way to calculate banner height automatically based on device in which app is running?
B) I tried mycode, but i don't get any logs, and i don't see an adview. I really don't understand the issue. I'm trying it on a simulator

B4X:
Private Sub Page_Resize(Width As Int, Height As Int)
    SetLayout
  
    iad.Initialize("iad","ca-app-pub-xx",mpa,iad.SIZE_BANNER)
    Dim no As NativeObject = Me
    iad.SetTestDevices(Array(no.RunMethod("simulatorId", Null)))
    iad.LoadAd
    iad.Color = 0xff0000ff
    pnlroot.AddView(iad,0,pnlroot.Height-50,300,50)
End Sub

Sub iad_ReceiveAd
    Log("ecchime")
End Sub

Sub iad_FailedToReceiveAd (ErrorCode As String)
    Log(ErrorCode)
End Sub

#if objc
#import <GoogleMobileAds/GoogleMobileAds.h>
- (NSObject*)simulatorId {
   return kGADSimulatorID;
}
#end if

Thanks to all!
 

sorex

Expert
Licensed User
Longtime User
if you create a new ad placement in admob it needs a few hours before it will become active.

So don't panic if it doesn't seem to work again in your next app with a new placement. ;)
 
Upvote 0

Similar Threads

Top