Android Question Library Admob

guido valentino

Member
Licensed User
Longtime User
hello,
I followed the erel's tutorial but when I start the app does not start the publicity. I noticed that I have to change to run admob pakage in Project / Build Configuration with: mobi.mindware.admob. Is there a way to leave the name of pakage? thanks
 

guido valentino

Member
Licensed User
Longtime User
this is the code

B4X:
#Region  Project Attributes 
    #ApplicationLabel: Admob Interstitial Example
    #VersionCode: 2
    #VersionName: 2.0
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #AdditionalRes: C:\Android\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms   
#End Region

'admob interstitial library example
'for use with Google Play services library
'Written by: Jack Cole
'Mindware Consulting, Inc.

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 mwAdInterstitial As mwAdmobInterstitial
    Dim Button1 As Button
    Dim Label2 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    mwAdInterstitial.Initialize("mwadi","ca-app-pub-........")
    mwAdInterstitial.LoadAd
    Activity.LoadLayout("1")
    Label2.Text="Attempting to load ad...  Please wait."
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub mwadi_AdClosed
    Label2.Text="Ad dismissed by user."
    Button1.Text="Load Ad"
    'you can call LoadAd again here to queue the next ad
End Sub
Sub mwadi_AdOpened
    Log("ad opened")
End Sub
Sub mwadi_AdLoaded
    Log("ad loaded")
    Button1.Text="Show Ad"
    Label2.Text="Ad loaded - Click Show Ad to Display"
End Sub

Sub mwadi_AdFailedToLoad (ErrorMessage As String)
    Label2.Text="Ad failed to load with error code: " & ErrorMessage
    Log("failed to load ad: " & ErrorMessage)
End Sub

Sub Button1_Click
    If mwAdInterstitial.Status=mwAdInterstitial.Status_AdReadyToShow Then mwAdInterstitial.Show 
    If mwAdInterstitial.Status=mwAdInterstitial.Status_Dismissed Then 
        Label2.Text="Attempting to load ad...  Please wait."
        mwAdInterstitial.LoadAd
    End If
End Sub
this is the manifest
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
'admob interstitial
AddApplicationText(
<meta-data android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version"/>
 <activity android:name="com.google.android.gms.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

)

When i start the app in label2 text: Ad failed to load with error code: internal error
 
Upvote 0
Top