Android Question InterstitialAd Disable back button

BugNot

Member
Hello,

I've problem with back button...

When an admob Interstitial ad is displayed, if you press the back button, you can close the ad before the ad countdown ends.
I tried with a timer but the activity pauses and the timer does not work.

How do I fix this?



Thank you
 

BugNot

Member
B4X:
Sub Globals
    Private mwAdInterstitial As InterstitialAd
End Sub

Sub Activity_Create(FirstTime As Boolean)
    mwAdInterstitial.Initialize("mwadi","ca-app-pub-3940256099942544/8691691433")
    mwAdInterstitial.LoadAd
End Sub

Sub chargePub
    If (mwAdInterstitial.IsInitialized) And (mwAdInterstitial.Ready) Then
        mwAdInterstitial.Show
    End If
End Sub

'Pub fermée
Sub mwadi_AdClosed
    Log("mwadi AdClosed")
    mwAdInterstitial.LoadAd 'prepare a new ad
    'pub finie on ouvre Session
    StartActivity(Sessions)
End Sub
Sub mwadi_AdFailedToLoad (ErrorMessage As String)
    Log("mwadi AdFailedToLoad: " & ErrorMessage)
End Sub
Sub mwadi_AdLoaded
    Log("mwadi Adloaded")
End Sub
Sub mwadi_ReceiveAd
    Log("mwadi ReceiveAd")
End Sub
Sub mwadi_AdScreenDismissed
    Log("mwadi AdScreenDismissed")
End Sub
It may be possible to integrate this ad in a panel so I can manage the back button?
 

BugNot

Member
Hi Erel, thanks for your help.

Currently yes, I am on the main activity, on the menu I click for a new activity sessions, the ad is displayed and then we open the new activity.

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
click menu session => ad open
** Activity (main) Pause, UserClosed = false **
ad closed
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (sessions) Create, isFirst = true **
** Activity (sessions) Resume **

Before that, I tried on the button click event in the sessions activity:

** Activity (sessions) Create, isFirst = true **
** Activity (sessions) Pause, UserClosed = false **
** Activity (sessions) Resume **
click button => ad open
** Activity (sessions) Pause, UserClosed = false **
ad closed
** Activity (sessions) Resume **

Each time the ad pauses the activity in progress.
 

BugNot

Member
Could the real ad prevent the back button? For the moment it is test ads.

If not, what would be the possible solution?
 

BugNot

Member
OK, it's a shame, so I'm going to put a reward ad but my application is not a game lol I tested it and it works.

Thanks Erel, have a good day.
 
Top