B4A Tutorial [B4X] OkHttpUtils2 with Wait For - Erel    
Dec 25, 2025   
(60 reactions) have a single sub that handles all requests results.
Simplest example:
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://www.google.com")
Wait For (j) JobDone(j... a quotes service:
Sub DownloadQuote
Dim j As HttpJob
j.Initialize("", Me) 'name... also other subs that send HttpJobs. As each HttpJob is unique, all the events will reach the correct....Initialize("", Me) 'name is empty as it is no longer needed
j.Download("https...
B4A Tutorial [B4X] OkHttpUtils2 / iHttpUtils2 and accept all option - Erel    
Jul 27, 2025   
(17 reactions)Note that OkHttpUtils2, jOkHttpUtils2 and iHttpUtils2 are actually the exact same b4x library.
Starting from v2.90 it is very simple to initialize the internal http client with the 'accept all' option.
The accept all option means that certificates will not be validated.
It is done by adding the following conditional symbol (Ctrl + B):
HU2_ACCEPTALL
There is another configurable conditional symbol:
HU2_PUBLIC - makes the http client variable (hc) a public variable. This can be used in...
B4A Code Snippet Set HTTP Request Header with OkHttpUtils2 - Erel    
Sep 17, 2018   
(12 reactions)Description: The following code allows you to set the request headers before the request is sent. This is useful for example with sites that block requests without a User-Agent header.
This code depends on HttpUtils2 and Http libraries:
Dim j As HttpJob
j.Initialize("job name", Me)
j....
The content type header should be set with SetContentType.
Tags: http headers, httputils2, user agent.... However internally HttpJob uses CallSubDelayed to send the request. So the request will only be sent...
B4A Library OkHttpUtils2 v3.02 - Erel    
Mar 22, 2023   
(26 reactions)All previous versions of OkHttpUtils2 relied on a service. As it is no longer possible to start... version HttpUtils2Service is actually a receiver. It should be transparent for developers.
Note...
link:
All previous versions of OkHttpUtils2 relied on a service. As it is no longer possible to start...
link: pem files
After looking in OkHttp library. I did not find a way to add truststore to hc...
link: Try looking here, maybe it could help you. --> Client certificates with OkHttpUtils2...
B4A Library [B4X] Client certificates with OkHttpUtils2 SSLContext-Kickstart - Erel    
Jul 26, 2021   
(9 reactions) configuring OkHttpUtils2 to use an external keystore and include client certificates.
'Press Ctrl + B... As String, StorePassword As String)
Dim hc As OkHttpClient = HttpUtils2Service.hc
Dim...
link: Button1_Click
Dim GetEnviroment As String
httpClient.InitializeAcceptAll("httpClient"...
link: Thanks :)...
link: 147013...
B4A Question OkHttpUtils2 causes false positive and Google Drive download failure - Alessandro71    
Jun 10, 2023   
(1 reaction) an empty app looks suspicious!
Now add OkHttpUtils2 version 3.01 from the libraries window.
No need..., but the OkHttpUtils2 library is extensively used in many projects of mine....Since I was hit by the Google Drive false positive on APK issue (https://www.b4x.com/android/forum/threads/solved-investigating-googles-false-positive-virus-checks.147537/), I've done some...
link: some more testing on the subject
since OkHttpUtils2 is a B4X lib, I extracted the 2 source files...
B4A Code Snippet Register User example using OkHttpUtils2 - aeric    
Jan 26, 2023   
(49 reactions)Register User example using OkHttpUtils2
77216 77217 77218 77219 77220 77221
Updates... 2019)
- Set targetSdkVersion=26
- Replaced HttpUtils2 with OkHttpUtils2
- Changed conflicting Job... a listview.
This code snippet demonstrates of the usage of :
1. HttpUtils2 to connect to MySQL... As HttpJob
Job4.Initialize("LogOut", Me)
Job4.Download2(Main.strURL & "signout...
End If
Dim Job5 As HttpJob
Job5.Initialize("ResetPassword", Me)
Job5.Download2...
B4J Library OkHttpUtils2 - Erel    
Oct 20, 2019   
(10 reactions)jOkHttpUtils2 is a b4x lib included with B4J. The source code is inside the library (it is a zip file)....
link: =Cosa) Then
Dim job1 As HttpJob
Dim requestBody As String
Dim Id1 As Int...
link: ) Then
Dim job1 As HttpJob
Dim requestBody As String
Dim Id1 As Int = Vecchio...
link: job5 As HttpJob
Dim requestBody As String
job5.Initialize("job5", Me...
B4A Question Exception with OkHttpUtils2 - Wosl    
Apr 12, 2026 failed (#2): " & LastException.Message)
ier = 2
End Try
If j.IsInitialized...Dear All!
I need some guidance ...
What I want to do:
geocoding of a given postal address which...
link: ", "addressdetails", "1")
Dim j As HttpJob
j.Initialize("...
link: Again, thank you for your responses.
I'll give the solution with
j.GetRequest.SetHeader("...
link:
Why use what you say?
https://www.b4x.com/android/forum/threads/when-to-use-setcontenttype-or...
B4A Code Snippet Disable automatic redirections with OkHttpUtils2 - Erel    
Jun 1, 2020   
(1 reaction)Step 1: Add to build configuration (Ctrl + B): HU2_PUBLIC
Step 2: Add to starter service:
Sub Service_Create
Dim jo As JavaObject = HttpUtils2Service.hc
Dim builder As JavaObject = jo.RunMethod("sharedInit", Array("hc"))
builder.RunMethod("followRedirects"... Activity_Create(FirstTime As Boolean)
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://www.b4x.com/b4a")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then...
Page: 1  
2  
3  
4  
5  
6  
7