Help with HttpUtils2 error in a Service module

Peter Simpson

Licensed User
Hiya all,
Last night I decided to convert one of my Widgets projects from using HttpUtils to using Http2Utils. The following basic code works perfect in an 'Activity module', but in a ''Service module' I just keep getting the following error.

** Service (stardatewidget) Create **
** Service (stardatewidget) Start **
httpjob_download (java line: 77)

It appears to fall over on the following line which works in an 'Activity module'.


I've cut all the code out and just left the following code, I'm still getting the same error.

'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

Dim GetWeatherDataXML As HttpJob
Dim WeatherDataXML As String
Dim RV As RemoteViews
End Sub

Sub Service_Create
RV = ConfigureHomeWidget("testlayout", "RV", 30, "Test Weather Data", True)
End Sub

Sub Service_Start(StartingIntent As Intent)
GetWeatherDataXML.Initialize("GetWeatherDataXML", Me)
End Sub

Sub Service_Destroy
End Sub

Sub JobDone(Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)

If Job.Success = True Then
Select Job.JobName
Case "GetWeatherDataXML"
WeatherDataXML = Job.GetString
End Select
ToastMessageShow("Oops: " & Job.ErrorMessage, True)
Log("Oops: " & Job.ErrorMessage)
End If

End Sub

Any help would be seriously appreciated as the above code works perfect in an 'Activity module' but falls over in an 'Service module'.

Thank you

Peter Simpson

Licensed User
Wow, that did it.

You should download v2.02. It will probably fix this issue (it is hard to say without the full error message from the logs).

I've been looking through my code all night and the forums looking for a solution. I was going to create a bug report but thought I must be missing something and didn't want to look silly reporting a bug if there was not one(well, there was).

Anyway, as usual you have come up trumps with the answer and it worked even with my full project which I have know restored...

Thank you again Erel :)
Upvote 0