Hi,
i have an app that use HttpJob and Wait For (j) jobDone(j As HttpJob) for different kind of request.
All works correctly but yesterday the app (running on different tablet but only one had the problem) on a request not had JobDone event so all other successive httpjob request was blocked.
I think to have correctly implemented the code, how can i solve this problem? Is not a frequent event so is not simply replicable but it's appen...
I post significant part of my code:
And each of bold sub is similar:
In the log i see at a certain time :
But after there isn't the log for j.succes or j.error (all the other time there is and the ion_event is correct)
After 15minutes the sub UpdateConfig restart (called from a timer) but in the log there isn't the print ESTRAGGO CONFIG OLD as if the resumable sub UpdateConfig doesn't start!!!!!!
Suggestions? Thanks
i have an app that use HttpJob and Wait For (j) jobDone(j As HttpJob) for different kind of request.
All works correctly but yesterday the app (running on different tablet but only one had the problem) on a request not had JobDone event so all other successive httpjob request was blocked.
I think to have correctly implemented the code, how can i solve this problem? Is not a frequent event so is not simply replicable but it's appen...
I post significant part of my code:
B4X:
Sub UpdateConfig
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"ESTRAGGO CONFIG OLD")
wait for ([B]InitFileConfigOld[/B]) complete (result As Boolean)
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"FINITO")
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"ESTRAGGO PAZIENTI")
wait for ([B]EstraiPazienti[/B]) complete (result As Boolean)
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"FINITO")
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"ESTRAGGO SOGLIE")
wait for ([B]ChiediSoglie[/B]) complete (result As Boolean)
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"FINITO")
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"ESTRAGGO APPUNTAMENTI")
wait for ([B]ChiediAppuntamenti[/B]) complete (result As Boolean)
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"FINITO")
End Sub
And each of bold sub is similar:
B4X:
Sub InitFileConfigOld As ResumableSub
Dim j As HttpJob
Dim jg As JSONGenerator
Dim m As Map
Dim stringConfig As String = ""
Dim NowFix As Long
Dim s As String
Dim Intent1 As Intent
Dim sie As String
If MyId <> "" Then
NowFix = DateTime.Now/1000
s = NowFix
Intent1.Initialize("android.intent.action.SEND","")
Intent1.PutExtra("cmd","deviceID")
Intent1.putExtra("signPls", s)
Intent1.SetPackage(Package)
Intent1.SetType("text/plain")
'Log(Intent1)
StartActivityForResult(Intent1)
Wait For ion_Event (MethodName As String, Args() As Object)
If -1 = Args(0) Then 'resultCode = RESULT_OK
Dim k As Intent = Args(1)
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"extra: " & k.ExtrasToString)
If k.HasExtra("senderid_enc") Then
sie = k.Getextra("senderid_enc")
'Log(sie)
m.Initialize
m.Put("device_id",MyId)
m.Put("epoch",NowFix)
m.Put("senderid_enc",sie)
jg.Initialize(m)
stringConfig = jg.ToString
'Log(stringConfig)
j.Initialize("",Me)
j.PostString(ServerRiferimento & "/tablet_get_cfg",stringConfig)
j.GetRequest.SetContentType("application/json")
j.GetRequest.SetContentEncoding("utf-8")
Wait For (j) jobDone(j As HttpJob)
If j.Success Then
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"SUCCESS " & j.GetString)
EstraiJsonConfigOld(j.GetString)
'creo un file di configurazione in locale per usarlo in caso di assenza connessione
If File.Exists(File.DirInternal,Starter.filenameConfig) Then
File.Delete(File.DirInternal,Starter.filenameConfig)
End If
Starter.Writer.Initialize(File.OpenOutput(File.DirInternal, Starter.filenameConfig, True))
Starter.Writer.WriteLine(j.GetString)
Starter.Writer.Close
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"PUNTO 1")
j.Release
Return True
Else
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"http get error : " & j.ErrorMessage)
'qui devo usare il file di config locale se ce l'ho
If File.Exists(File.DirInternal,Starter.filenameConfig) Then
Starter.Reader.Initialize(File.OpenInput(File.DirInternal, Starter.filenameConfig))
stringConfig = Starter.Reader.Readall
Starter.Reader.Close
EstraiJsonConfigOld(stringConfig)
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"PUNTO 2")
j.Release
Return True
Else
SetVersionAndId
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"il file di CONFIG NON esiste")
'METTO UN ERRORE GIGANTE A VIDEO????
xui.MsgboxAsync("ERRORE : FILE DI CONFIGURAZIONE NON TROVATO", "Config")
j.Release
Return False
End If
End If
Else
'qui devo usare il file di config locale se ce l'ho
If File.Exists(File.DirInternal,Starter.filenameConfig) Then
Starter.Reader.Initialize(File.OpenInput(File.DirInternal, Starter.filenameConfig))
stringConfig = Starter.Reader.Readall
Starter.Reader.Close
EstraiJsonConfigOld(stringConfig)
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"PUNTO 3")
Return True
Else
SetVersionAndId
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"il file di CONFIG NON esiste")
'METTO UN ERRORE GIGANTE A VIDEO????
xui.MsgboxAsync("ERRORE : FILE DI CONFIGURAZIONE NON TROVATO", "Config")
Return False
End If
End If
Else
'qui devo usare il file di config locale se ce l'ho
If File.Exists(File.DirInternal,Starter.filenameConfig) Then
Starter.Reader.Initialize(File.OpenInput(File.DirInternal, Starter.filenameConfig))
stringConfig = Starter.Reader.Readall
Starter.Reader.Close
EstraiJsonConfigOld(stringConfig)
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"PUNTO 4")
Return True
Else
SetVersionAndId
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"il file di CONFIG NON esiste")
'METTO UN ERRORE GIGANTE A VIDEO????
xui.MsgboxAsync("ERRORE : FILE DI CONFIGURAZIONE NON TROVATO", "Config")
Return False
End If
End If
Else
MyLog(Main.LIVELLO_DEBUG_MAIN_PAGE,"id non presente")
Return False
End If
End Sub
In the log i see at a certain time :
04/10/21 18:23:55_196 ESTRAGGO CONFIG OLD
04/10/21 18:23:55_461 extra: Bundle[{senderid_enc=YCafpX......
04/10/21 18:23:55_482 SAVER APPEAR
04/10/21 18:24:16_629 OXY stop-start scan
04/10/21 18:24:18_517 PRESS stop-start scan
04/10/21 18:24:18_730 TEMP stop-start scan
04/10/21 18:24:46_846 OXY stop-start scan
But after there isn't the log for j.succes or j.error (all the other time there is and the ion_event is correct)
After 15minutes the sub UpdateConfig restart (called from a timer) but in the log there isn't the print ESTRAGGO CONFIG OLD as if the resumable sub UpdateConfig doesn't start!!!!!!
Suggestions? Thanks