Hi.
My Android App has OkHttp and OkHttpUtils2 libraries. Now I use B4A v.8.80.
In this app, about two years ago I have implemented a HTTP communication with a remote server. May be that at that time I was using HttpUtils library.
The communication was working very good and was working in the iOS version of the same app too (with iHttp library).
This communication has been not used till today, but now I need to use it.
The JobDone event is the following (it'is the same in Android and in iOS):
The problem is that the Android app crashes when reach this line:
But the iOS app still works fine like two years ago.
If in the Android app I put a breakpoint before that line and I check J.Tag it appears as empty.
The Android Log is this:
Thanks a Lot to everybody.
My Android App has OkHttp and OkHttpUtils2 libraries. Now I use B4A v.8.80.
In this app, about two years ago I have implemented a HTTP communication with a remote server. May be that at that time I was using HttpUtils library.
The communication was working very good and was working in the iOS version of the same app too (with iHttp library).
This communication has been not used till today, but now I need to use it.
The JobDone event is the following (it'is the same in Android and in iOS):
B4X:
Sub JobDone(j As HttpJob)
If j.Success Then
If j.JobName = "signup" Then 'TEST 15/06/2017
Log("j.GetString = " & j.GetString)
Log("j.Tag = " & j.Tag)
If j.GetString.Contains("status") And j.GetString.Contains("ok") Then
Dim Headers As Map = j.tag
If Headers.Size > 0 Then
If Headers.Get(TokenHeaderName) <> "" Then
LastToken = Headers.Get(TokenHeaderName)
'*************************************
B4X:
Dim Headers As Map = j.tag
But the iOS app still works fine like two years ago.
If in the Android app I put a breakpoint before that line and I check J.Tag it appears as empty.
The Android Log is this:
The iOS Log is this:j.GetString = {"status":"ok"}
j.Tag = java.lang.Object@92d7b8a
Error occurred on line: 366 (Service2)
java.lang.ClassCastException: java.lang.Object cannot be cast to anywheresoftware.b4a.objects.collections.Map$MyMap
at anywheresoftware.b4a.objects.collections.Map.getSize(Map.java:111)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA$2.run(BA.java:370)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Please someone can help me to fix this problem?j.GetString = {"status":"ok"}
j.Tag = (read only map) {
Authorization = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjYwMzMsImlzcyI6Imh0dHBzOi8vbG9nLnJpdG1vLmNsb3VkL2FwaS9hdXRoL3NpZ251cCIsImlhdCI6MTU1MjY2MTQ0NiwiZXhwIjoxNTUyNjY1MDQ2LCJuYmYiOjE1NTI2NjE0NDYsImp0aSI6Im13b01OVVU5OGtDM3d1NGMifQ.zZ8sYcrOnCM1yqqZ8CtIoUWeSU6fWUXfQVNFaXXCYEw";
"Cache-Control" = "private, must-revalidate";
Connection = "keep-alive";
"Content-Type" = "application/json";
Date = "Fri, 15 Mar 2019 14:50:46 GMT";
Etag = "\"55a490e280d48996e564d00492437eb17faadd28\"";
Server = "nginx/1.10.3 (Ubuntu)";
"Transfer-Encoding" = Identity;
"X-RateLimit-Limit" = 1;
"X-RateLimit-Remaining" = 0;
}
Thanks a Lot to everybody.