Android Question Wait for service module to be completed and then continue

I want to use a service module(netconnection) that send and receive data to my remote server when it is called by callsubdelayed method. I use okhttputils2 to send my data in the service and if job.success was true then put a variable (the name is checktrue )=1.
When I click on "lbllamp" I want this service to be completed and if checktrue was 1 then do some stuff. I put part of my code here:
Sub lbllamp_Click
If netconnection.checktrue=1 Then
End If
End Sub

I checked and everything seems fine except that the callsubdelayed does not wait for service to be completed.
How is it possible to wait for service?
You should never call Service_Create yourself. If you want to start a service then call StartService.
But StartService also won’t wait for service to be completed. I’m looking for kind of “Wait For ( ) complete” method.

However the correct solution is to switch to B4XPages. Everything will be simple and you will not need to deal with all these cases.
Without a doubt B4XPages is a big progress for developers but I spent my last 3 months on this project and it’s hard to migrate to B4XPages at this time.
Last edited:
Upvote 0