Android Question wait for question

tufanv

Expert
Licensed User
Longtime User
Hello

Is it possible to us wait for with stg like or ? I want to load an interstital ad and wait for fail or received and continue.

Currently I use :

B4X:
    Wait For iad_ReceiveAd 
    If IAd.Ready=True Then
    IAd.Show
    panelloading.Visible=False
    panelana.Visible=True
    panelreklam.Visible=True
    Else
    End If

but here , if ad fails to load , I think app will have to wait forever so it possible to do stglike this : wait for iad_receivead or iad_failedtoreceivead ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I think app will have to wait forever
The app or main thread never waits for anything when you call Wait For. Nothing bad will happen if iad_ReceiveAd is never raised.

You cannot call Wait For with two events. You can do something like:
B4X:
Sub iad_FailedToReceiveAd (ErrorCode As String)
 CallSub(Me, "iad_ReceiveAd")
End Sub

Now you can wait for iad_ReceiveAd and just make sure to always check whether IAD.Ready is true.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
I was about to ask why you'd want to sit and wait for an advert - but guess that you want to ensure that it is displayed before permitting a user to proceed..

As Erel has mentioned the main thread will keep on going anyway. Have you looked at Rewarded Ads that might be the way to go?
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
The app or main thread never waits for anything when you call Wait For. Nothing bad will happen if iad_ReceiveAd is never raised.

You cannot call Wait For with two events. You can do something like:
B4X:
Sub iad_FailedToReceiveAd (ErrorCode As String)
CallSub(Me, "iad_ReceiveAd")
End Sub

Now you can wait for iad_ReceiveAd and just make sure to always check whether IAD.Ready is true.
I have a splash screen at startup , i need to show ad before proceeding to main view, so if it cant load the ad, i want to skip waiting because, i dont show the main screen beofre iad.show. Also i dont want to repeat the loadad , i want to call iad.requestad if it succeeds it must show the ad and continue, if it fails , i want it to continue to main screen without trying again.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I was about to ask why you'd want to sit and wait for an advert - but guess that you want to ensure that it is displayed before permitting a user to proceed..

As Erel has mentioned the main thread will keep on going anyway. Have you looked at Rewarded Ads that might be the way to go?
Rewarded ads not good for me.:/
 
Upvote 0
Top