Hello,
I use B4A with mqtt library and try to build connect and reconnect with code from this tutorial.
https://www.b4x.com/android/forum/threads/b4x-mqtt-connect-reconnect.80815/
everything is fine, but after I try to disable internet connection on my phone error occurs. I change the code with try catch but no luck, then I read some forum they suggest to update version to mqttv3:1.1.1, is it true? hope somebody could help to continue my learning with B4A. If any newer library version, where I can download? I attached the error message, thanks.
I use B4A with mqtt library and try to build connect and reconnect with code from this tutorial.
https://www.b4x.com/android/forum/threads/b4x-mqtt-connect-reconnect.80815/
everything is fine, but after I try to disable internet connection on my phone error occurs. I change the code with try catch but no luck, then I read some forum they suggest to update version to mqttv3:1.1.1, is it true? hope somebody could help to continue my learning with B4A. If any newer library version, where I can download? I attached the error message, thanks.
B4X:
Error connecting.
Trying to connect
Error connecting.
Trying to connect
Error occurred on line: 35 (Starter)
java.lang.NullPointerException: Attempt to invoke virtual method 'org.eclipse.paho.client.mqttv3.IMqttToken org.eclipse.paho.client.mqttv3.MqttAsyncClient.connect(org.eclipse.paho.client.mqttv3.MqttConnectOptions, java.lang.Object, org.eclipse.paho.client.mqttv3.IMqttActionListener)' on a null object reference
at anywheresoftware.b4j.objects.MqttAsyncClientWrapper.Connect2(MqttAsyncClientWrapper.java:83)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
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.raiseEvent(BA.java:176)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1705)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6746)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)