B4A Tutorial [B4X] OkHttpUtils2 with Wait For - Erel    
Dec 25, 2025   
(60 reactions)256583317
Downloading resources is simpler with the new Resumable Subs feature.
Using Wait For we can wait for the JobDone event in the same sub that started the download.
No longer is it needed to 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 As HttpJo...
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.Download(<link>) 'it can also be PostString or any of the other methods
j.GetRequest.SetHeade...
B4A Question Latest OkHttpUtils working with Android 4? - udg    
Aug 19, 2022Hi all.
I have an old widget of mine running on an Android 4.4 device. I have to update it now, but I recall something changed in the underlying lib which causes current OkHttpUtils working from Android 5 up.
So my question is: which is the latest B4A version sporting a copy of OkHttpUtils compatible with Android 4 devices? I plan to copy it to the Additonal Libs folder (while changing its name) and select it when compiling for my old device. For newer devices I will instead select the lib...
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 services when the app starts in the background, this configuration is problematic and it will fail in...
link:
Hi All,
When connecting to server, I need to use mutual authentication with client p12 and server p...
link: Try looking here, maybe it could help you. --> Client certificates with OkHttpUtils2...
link:
All previous versions of OkHttpUtils2 relied on a service. As it is no longer possible to start...
B4A Library [B4X] Client certificates with OkHttpUtils2 SSLContext-Kickstart - Erel    
Jul 26, 2021   
(9 reactions)This is a B4A + B4J library.
This code uses JavaObject to access SSLContext-Kickstart SDK (v5.0.0): https://github.com/Hakky54/sslcontext-kickstart/tree/v5.0.0
License: Apache 2.
It allows configuring OkHttpUtils2 to use an external keystore and include client certificates.
'Press Ctrl + B and add HU2_PUBLIC as a conditional symbol!
Private Sub SetSSLFactory (StoreDir As String, StoreFile As String, StorePassword As String)
Dim hc As OkHttpClient = HttpUtils2Service.hc
Dim...
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....
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:
This project is deprecated. Please check User Login + MySQL PHP API
https://www.b4x.com/android/forum/threads/user-login-mysql-php-api.117826/
Introduction
This code snippet is based on the thread posted by KMatle in Tutorials & Examples. You can modify the layout and add in to your apps so... 2019)
- Set targetSdkVersion=26
- Replaced HttpUtils2 with OkHttpUtils2
- Changed conflicting Job...
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 fil...
link: Moved to the questions forum. As @aeric wrote, you should either use PostString (POST request) or Pu...
link: RESOLVED !!
delete job1.PostString(Sito,"PUT") and job5.PostString(Sito,"POST")...
link: RESOLVED !!
Thank you - perfect...
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", Array(False))
builder.RunMethod("followSslRedirects", Array(False))
jo.SetField(&...
Page: 1  
2  
3  
4  
5  
6  
7