Hi, I've been having issues with silent retries when consuming a REST API using OkHttpUtils2, with poor cellular connections. And I saw that I can remove these retries by set retryOnConnectionFailure to False.
'Replace the existing method in HttpUtils2Service
Sub Initialize
If hc.IsInitialized = False Then
TempFolder = File.DirTemp
Dim jo As JavaObject = hc
Dim builder As JavaObject = jo.RunMethod("sharedInit", Array("hc"))
builder.RunMethod("retryOnConnectionFailure", Array(False))
jo.SetField("client", builder.RunMethod("build", Null))
TaskIdToJob.Initialize
End If
End Sub
Sub Service_Create
Dim jo As JavaObject = HttpUtils2Service.hc
Dim builder As JavaObject = jo.RunMethod("sharedInit", Array("hc"))
builder.RunMethod("retryOnConnectionFailure", Array(False))
jo.SetField("client", builder.RunMethod("build", Null))
End Sub
It doesn't need to be in the starter service if using B4XPages.
Thank you Erel for your response. I followed your example, I added HU2_PUBLIC to the build configuration, I added the code to the Service_Create, but it gives me this error: