I have a strange problem with HttpJob not working in a very specific case. I feel there's probably some concept here that I am unaware of, but I can't figure out what it could be. (Nor was I able to find a forum post about this, sorry if I missed it.)
Once I start my app, the genericRequest below is called every ten seconds via a timer, and it works like a charm.
But if I put my app in the background, open the Recent apps and swipe-kill it, and then re-open the app from the Desktop, it fails. (If I then do a Force close of the app and start it again it works fine.)
I've read Erels post The result of swiping an app from the recent apps list so I understand that there's some service stuff still running (perhaps) in the background. And when I force close the app I also kill that. Fine, but how does that in any way affect my ability to use HttpJob??
I should also say that I'm running my app as Release, with BridgeLogger enabled. And I control the receiving server so I've verified that it doesn't get any kind of request in this situation.
This is my code. I have verified that the incoming values are fine. (This means they are identical to when the request works.) In the log I can see GENERIC: 1 just fine, but GENERIC: 2 never happens, even after 30 seconds (or ten minutes for that matter).
Any ideas?
Once I start my app, the genericRequest below is called every ten seconds via a timer, and it works like a charm.
But if I put my app in the background, open the Recent apps and swipe-kill it, and then re-open the app from the Desktop, it fails. (If I then do a Force close of the app and start it again it works fine.)
I've read Erels post The result of swiping an app from the recent apps list so I understand that there's some service stuff still running (perhaps) in the background. And when I force close the app I also kill that. Fine, but how does that in any way affect my ability to use HttpJob??
I should also say that I'm running my app as Release, with BridgeLogger enabled. And I control the receiving server so I've verified that it doesn't get any kind of request in this situation.
This is my code. I have verified that the incoming values are fine. (This means they are identical to when the request works.) In the log I can see GENERIC: 1 just fine, but GENERIC: 2 never happens, even after 30 seconds (or ten minutes for that matter).
Any ideas?
B4X:
Private Sub genericRequest (url As String, values As Map, files As List) As ResumableSub
Dim job As HttpJob
job.Initialize("", Me)
job.PostMultipart(url, values, files)
job.GetRequest.Timeout = 5000 ' This value doesnt affect anything for me
LogColor("GENERIC: 1", Colors.Cyan)
Wait For (job) JobDone(job As HttpJob)
LogColor("GENERIC: 2", Colors.Cyan)
' More code goes here, not displayed in the post
End Sub