Android Question admob 1.4 problem?

gunper

New Member
Licensed User
Longtime User
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim A8View As Canvas
Dim r As Rect
Dim r2 As Rect
Dim reset As Rect
Dim tx, ty As Int
Dim tw,th As Int
Dim ta As Int
Dim AdView1 As AdView
Dim bitmap1 As Bitmap

End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1")
A8View.Initialize(Activity) '
r.Initialize(0,0,0,0)
reset.Initialize(0,0,Activity.Width ,Activity.height) t
bitmap1.Initialize3(A8View.Bitmap) 'Set the canvas background as a bitmap


Dim height As Int
If (Activity.height > Activity.Width) Then 'Portrait Mode.
AdView1.Initialize2("Ad", "xxxxxxxxxxxxxxxxxxx", AdView1.SIZE_SMART_BANNER)
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then 'Phones
height = 50dip
Else 'Tablets
height = 90dip
End If
Activity.AddView(AdView1, 0dip, 100%y - height, 100%x, height)
Else 'Landscape Mode
AdView1.Initialize("Ad", "xxxxxxxxxxxxxxxxxxx")
Activity.AddView(AdView1,50%x - 160dip,100%y-50dip,320dip,50dip)
End If
AdView1.LoadAd

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Ad_FailedToReceiveAd (ErrorCode As String)
Log("failed: " & ErrorCode)

End Sub
Sub Ad_ReceiveAd
Log("received")

End Sub
Sub Ad_AdScreenDismissed
Log("screen dismissed")

End Sub


hi there.
any body can help to get admob 1.4 to work right?
i got and error

UNFORTUNATELY, B4A EXAMPLE HAS STOPPED

my older one works fine,
since replace new version lib and change this new code, it doesn't seem working any more.
 

NJDude

Expert
Licensed User
Longtime User
A few comments:

1- Please use the [code] ... [/code] tags when posting code.
2- It would be better if you attached your project (Open the B4A IDE and click on FILE -> Export As ZIP)
3- "UNFORTUNATELY, B4A EXAMPLE HAS STOPPED" doesn't help, you should check the LOGS (filtered and unfiltered) the reason for the crash will be shown there.
 
Last edited:
Upvote 0
Top