Android Tutorial [B4X] OkHttpUtils2 / iHttpUtils2 and accept all option

Status
Not open for further replies.
Note that OkHttpUtils2, jOkHttpUtils2 and iHttpUtils2 are actually the exact same b4x library.
jOkHttpUtils2_NONUI was required as a special version for non-ui B4J apps. It is no longer required and shouldn't be used.

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 cases where you want to customize the internal behavior. It is more relevant to B4J and B4A.
Example: https://www.b4x.com/android/forum/threads/ntlm-again.110485/#post-690641

Note that in B4i you need to disable ATS for this to work:
B4X:
'in main module
#ATSEnabled: False
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Is v2.90 already published ?
 

peacemaker

Expert
Licensed User
Longtime User
But there is v.2.80... OK, nevermind.
 

avalle

Active Member
Licensed User
Longtime User
@Erel the Internal Library update page says jOkHttpUtils2 v2.80 but it should be v2.90
 

awama

Active Member
Licensed User
Longtime User
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…