Hi,
Just got myself a brand new Nexus5 and installed Android L on it so I can test my app on it.
Just noticed my app crashes when using SSL sockets.
The error that shows is the following:
It looks like it connects but soon as it connects it comes up with a error.
Anyone know how to fix this?
I really need this working otherwise my whole app is not going to work.
This is working fine on Android 4.4 (and below)
The code I am using is attached.
Just got myself a brand new Nexus5 and installed Android L on it so I can test my app on it.
Just noticed my app crashes when using SSL sockets.
The error that shows is the following:
B4X:
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:b4a.example
Connected - SSL Socket
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
at com.android.org.conscrypt.OpenSSLSocketImpl.shutdownAndFreeSslNative(OpenSSLSocketImpl.java:1102)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:398)
at com.android.org.conscrypt.OpenSSLSocketImpl.waitForHandshake(OpenSSLSocketImpl.java:604)
at com.android.org.conscrypt.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:566)
at elbarto.android.SocketSSL.getInputStream(SocketSSL.java:136)
at b4a.example.main._my_ssl_socket_connected(main.java:410)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
at anywheresoftware.b4a.BA$3.run(BA.java:319)
at android.os.Handler.handleCallback(Handler.java:738)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5070)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
android.os.NetworkOnMainThreadException
** Activity (main) Resume **
It looks like it connects but soon as it connects it comes up with a error.
Anyone know how to fix this?
I really need this working otherwise my whole app is not going to work.
This is working fine on Android 4.4 (and below)
The code I am using is attached.