Trying to add advertisement into an app. There is an error when the app tries to load the add: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@Integer/google_play_services_version" />
The error occurs on the line "BannerAd.LoadAd". Anyone knows why?
The error occurs on the line "BannerAd.LoadAd". Anyone knows why?
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim BannerAd As AdView
Dim IAd As InterstitialAd
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Dim p As Panel = LoadAd("ca-app-pub-5725771019370401/3534296381")
Activity.AddView(p,0,0,p.Width,p.Height)
End Sub
Sub LoadAd(AdID As String) As Panel
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
BannerAd.Initialize("BannerAd", AdID)
BannerAd.Width = 100%x
BannerAd.Height = height
Dim p As Panel: p.initialize("BannerAd")
p.Width = BannerAd.Width
p.Height = BannerAd.Height
p.AddView(BannerAd,0,0,p.Width,p.Height)
BannerAd.LoadAd
Return p
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub