B4A Library Admob Interstitial Library

CyclopDroid

Well-Known Member
Licensed User
Longtime User
Exuse me Jack but, in other android forum question, I see when the problem to No Fill it's caused by size of reuest or when not run AdMob in test mode.
If I run your simply example, the message appears immediately... if report in my source not enter in the Sub Activity_KeyPress and not work


B4X:
Sub Globals
Dim mwAdInterstitial As mwAdmobInterstitial 'AdMob Interstitial
......
......
......
Sub Activity_Create(FirstTime As Boolean)

mwAdInterstitial.Initialize("mwadi","ca-app-pub-xxxxxxxxxxxxxxxxx")
mwAdInterstitial.LoadAd
Activity.LoadLayout("Livelli")
------
.......
......
Sub mwadi_AdLoaded
    Log("ad loaded")
End Sub

Sub mwadi_AdFailedToLoad (ErrorCode As String)
    Log("failed to load ad: " & ErrorCode)
    Activity.Finish
    StartActivity(Main)
End Sub


Sub mwadi_AdClosed
    'you can call LoadAd again here to queue the next ad
End Sub

If I ceate, into my project, a new Module (with new visual designer) and insert here your code example.... when I call this, appears in the screen "Attempting to load ad... Please wait.", pass tp Activity_Resume and ends without going to nowhere.

Thaks you for help
 
Last edited:

Jack Cole

Well-Known Member
Licensed User
Longtime User
Did you set up a new ad unit in admob for Interstitial ads? I'm not sure, but you may need to initialize and load your interstitial in activity_resume instead of activity_create.
 

CyclopDroid

Well-Known Member
Licensed User
Longtime User
To be honest, I did not Admob Interstitial ad units, but I use only one with Admob Click on my other application.
Maybe that's the problem of the No Fill? If the answer is yes, how do I create an ID Admob Interstitial, if my game has not been published? And why, in my game, it's not recognized even the eroor, not entering into Sub mwadi_AdFailedToLoad?
Thanks again for your patience..
 

jmon

Well-Known Member
Licensed User
Longtime User
I don't see when the event "mwadi_AdOpened" is fired? Actually on my app, it's never fired.

I would like to know when a user clicked on an ad.

Thanks again for this library.

[Edit] I saw the mwadi_AdOpened event from the example.
 

Douglas Farias

Expert
Licensed User
Longtime User
i m got this error
failed to load ad: Internal error

what cause this error? i have check my appId and this its correct.

can is my google player services? i go the last now

any error or log about error, ad dont load andi got only failed to load ad: Internal error



Edit: already know the error, admob banned this app xD
 
Last edited:

Andre Souza

Member
Licensed User
Hello
I tested the example with the Google Play Services , but in time to show the announcement , only carries a black screen with a close button .
 

Douglas Farias

Expert
Licensed User
Longtime User
Hi.
I see today on google play a lot of this errors

java.lang.NoClassDefFoundError
in com.google.android.gms.ads.internal.zzs.<init>

I dont know if this error its really on your lib.
someone can give me a help to translate this?


Note: i m using Google Play Services REV 23
Note2: Try/Catch dont work here, the same log and mensage app stoped work show.

B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 121)
mwAdInterstitial.LoadAd
java.lang.NoClassDefFoundError: android.support.v4.util.SimpleArrayMap
    at com.google.android.gms.ads.internal.zzs.<init>(Unknown Source)
    at com.google.android.gms.ads.internal.zzs.<init>(Unknown Source)
    at com.google.android.gms.ads.internal.zzb.<init>(Unknown Source)
    at com.google.android.gms.ads.internal.zzc.<init>(Unknown Source)
    at com.google.android.gms.ads.internal.zzk.<init>(Unknown Source)
    at com.google.android.gms.ads.internal.ClientApi.createInterstitialAdManager(Unknown Source)
    at com.google.android.gms.ads.internal.client.zzl.createInterstitialAdManager(Unknown Source)
    at com.google.android.gms.ads.internal.client.zze.zzb(Unknown Source)
    at com.google.android.gms.ads.internal.client.zzac.zzH(Unknown Source)
    at com.google.android.gms.ads.internal.client.zzac.zza(Unknown Source)
    at com.google.android.gms.ads.InterstitialAd.loadAd(Unknown Source)
    at mobi.mindware.admob.interstitial.AdmobInterstitialsAds.LoadAd(AdmobInterstitialsAds.java:91)
    at leitor.df.texto.main._activity_create(main.java:451)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at leitor.df.texto.main.afterFirstLayout(main.java:102)
    at leitor.df.texto.main.access$000(main.java:17)
    at leitor.df.texto.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5041)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    at dalvik.system.NativeStart.main(Native Method)

the error ignore the try catch and crash the app.
B4X:
            Try
    'INICIA INTERSTITIAL
        mwAdInterstitial.Initialize("mwadi","ca-app-xxxxxxxxxxxxxxxxxxxxxx")
        mwAdInterstitial.LoadAd
    'FIM
        Catch
        Log("Erro interstitial")
        End Try
 
Last edited:

Jack Cole

Well-Known Member
Licensed User
Longtime User
Douglas,

You need to include the support for android-support-v4.jar. Please see this post by Erel.

Jack


 

sorex

Expert
Licensed User
Longtime User
Hello,

While this library seems to work fine I notice some issues here.

After a few ad displays I notice that it seems to be stuck somewhere in the loading.

When I ad logging in all subs I see loading ad, display ad but the "ad loaded" one doesn't happen anymore.

Anyone else noticed this behaviour?
 

sorex

Expert
Licensed User
Longtime User
can it be that an app resume pauses the ad displayer?

I see this in the logs

load ad
ad loaded
display ad?
yes display ad
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (adi_adclosed)
running waiting messages (1)
** Activity (main) Resume **

ad loaded
load ad
display ad?
yes display ad
load ad
display ad?
yes display ad


after that it starts to fail (without errors tho)
 

sorex

Expert
Licensed User
Longtime User
just got home and did another test.

I could play the game a few times and got 3 or 4 ads.

I didn't touch the phone and the screen went out.

When I then complete a level no ads show up anymore.

Do I need to reinitialize the ad or something when it resumes?
 

sorex

Expert
Licensed User
Longtime User
I seem to have found the culprit.

When I pre-load the ad by using the [play game] button it fails once the app resumed.

When I pre-load the ad during the _AdClosed event it keeps working fine probably because the ad was already loaded before the resume hits.

Something is wrong but it can be avoided by using the method above and that was originally used in the example.
 

migrec

Member
Licensed User
Longtime User
Hi, I always get Network Error, even with erel's admob lib for banner ads.
There is only this in the logs:
B4X:
failed to load ad: Network Error
not much to show really, dont know what it could be.
 

ilan

Expert
Licensed User
Longtime User

make sure you are not using an ad blocker
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…