iOS Question how to use timer for http job?

Baris Karadeniz

Active Member
Licensed User
I want to use timer for http job. For example I will set it to 5 seconds and http job will be done every 5 seconds if I enable timer. If I disable timer http job will stop. How can I do this?

B4X:
Dim Job1 As HttpJob
      Job1.Initialize("MyJob", Me)
      Job1.Download2("http://www.xxx.com/yyy.php", Array As String("x", "y"))

Sub JobDone (Job As HttpJob)
    Log("Job completed: " & Job.Success)
    Job.Release
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
sub timer_tick
    Dim Job1 As HttpJob
    Job1.Initialize("MyJob", Me)
    Job1.Download2("http://www.xxx.com/yyy.php", Array As String("x", "y"))
end sub
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
When you type timer1. And click on initialize for example you can see the example.

While initializing you must set the interval. Later you can changw it via timer1.interval = 1000

1000means 1 second. You must set 5000 for 5 seconds. Later under sub timer1_tick tou can type what you want. Tou can use b4x object browser to help yourself or use the beginners guide as donmanfred suggested
 
Upvote 0
Top