I still see occasional errors in my dev console for null pointers and after looking around at some stuff I began to wonder about something.
In the tutorial it is recommended to check if a job finished while our activity was paused...
In JobDone we get all successful urls...
UrlDone fetches the resulting string...
In HttpUtils.GetString.....
.... Which leads me to my question:
If the job finished while the activity was paused and we then check all successful URLs again, what happens if the service was killed in the meantime? Wouldn't HttpUtilsService.TempFolder be null or at the very least empty? I am wondering this because if the service was killed /stopped then would this string even exist anymore?
In the tutorial it is recommended to check if a job finished while our activity was paused...
B4X:
Sub Activity_Resume
'Check whether a job has finished while the activity was paused.
If HttpUtils.Complete = True Then JobDone(HttpUtils.Job)
End Sub
In JobDone we get all successful urls...
B4X:
For i = 0 To HttpUtils.Tasks.size - 1
link = HttpUtils.Tasks.Get(i)
If HttpUtils.IsSuccess(link) Then UrlDone(link)
Next
UrlDone fetches the resulting string...
B4X:
aStr = HttpUtils.GetString (sUrl)
In HttpUtils.GetString.....
B4X:
Sub GetString(URL As String) As String
If IsSuccess(URL) = False Then
Log("Task not completed successfully.")
Return ""
End If
Return File.GetText(HttpUtilsService.TempFolder, SuccessfulUrls.Get(URL))
End Sub
.... Which leads me to my question:
If the job finished while the activity was paused and we then check all successful URLs again, what happens if the service was killed in the meantime? Wouldn't HttpUtilsService.TempFolder be null or at the very least empty? I am wondering this because if the service was killed /stopped then would this string even exist anymore?