In this cenario, the application finishes before the post is done.
What I want to achieve is that before the application ends, the post on the page is done.
log: 1,2,4,3.
I want the log to be 1,2,3,4.
Any help?
What I want to achieve is that before the application ends, the post on the page is done.
log: 1,2,4,3.
Waiting for debugger to connect...
Program started.
1
2
4
3
mensagem gravada: test message 21:41:02
I want the log to be 1,2,3,4.
Any help?
PHP:
<?php
//criamos o arquivo
$msg = $_GET['msg'];
$myfile = fopen("log.txt", "a") or die("Unable to open file!");
fwrite($myfile, "\n". $msg);
fclose($myfile);
echo "mensagem gravada: " . $msg
?>
B4X:
Sub AppStart (Form1 As Form, Args() As String)
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
Log(1)
If NotRegistered = True Then
GravarLog("test message")
End If
Log(4) ' This is happening before 3.'
End Sub
Sub NotRegistered As Boolean
Return True ' just for the sake of the example
End Sub
Sub GravarLog(msg As String)
Dim job1 As HttpJob
job1.Initialize("Job1", Me)
job1.Download2("https://kxmidia.app/kal/gravarlog.php", _
Array As String("msg", msg & " " & DateTime.Time(DateTime.Now)))
Log(2)
Wait For (job1) Jobdone(Job As HttpJob)
Log(3)
If Job.Success = True Then
Log(Job.GetString)
Else
LogError("Error: " & Job.ErrorMessage)
End If
Job.Release
ExitApplication
End Sub
Last edited: