Hi.
I have an Arduino IDE which is sending a log (String) every second by WIFI set up as an AP.
I have made the following in Starter service;
Sub Process_Globals
Public sok As Socket
End Sub
Sub Service_Create
sok.Initialize("SOKK")
sok.Connect( "192.168.11.254",8080,2000)
End Sub
public Sub SOKK_Connected (Successful As Boolean)
End Sub
Then in Main I have;
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private l2 As B4XView
Private tmr As Timer
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("APAM_WHITE_BIrd")
tmr.Initialize("tmr", 1000)
tmr.Enabled =True
end sub
Sub tmr_Tick
If Starter.sok.Connected Then
Dim tr As TextReader
tr.Initialize(Starter.Sok.InputStream)
Dim sb As StringBuilder
sb.Initialize
sb.Append(tr.ReadLine )
l2.Text= sb.ToString
Else
l2.Text="No Connect"
End If
End Sub
Compiling in debug with my Samsung Galaxy A52 USB connected it works, and my textbox (L2) is updated every second.
I then tried to compile in release mode, and get pages of errors.
The first line says;
b4xmainpage_tmr_tick(Java line 153)
Android.os.networkonmainthreadexception
at android.os.stricktmode$androidblockguardpolicy.onnetwork(Stricktmoode.java:1668
Running B4A 11.8 on windows 10.
I'm new to B4A so any help would bee very kind.
By the way;
Your Paypal donation do not work..
best regards svein
I have an Arduino IDE which is sending a log (String) every second by WIFI set up as an AP.
I have made the following in Starter service;
Sub Process_Globals
Public sok As Socket
End Sub
Sub Service_Create
sok.Initialize("SOKK")
sok.Connect( "192.168.11.254",8080,2000)
End Sub
public Sub SOKK_Connected (Successful As Boolean)
End Sub
Then in Main I have;
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private l2 As B4XView
Private tmr As Timer
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("APAM_WHITE_BIrd")
tmr.Initialize("tmr", 1000)
tmr.Enabled =True
end sub
Sub tmr_Tick
If Starter.sok.Connected Then
Dim tr As TextReader
tr.Initialize(Starter.Sok.InputStream)
Dim sb As StringBuilder
sb.Initialize
sb.Append(tr.ReadLine )
l2.Text= sb.ToString
Else
l2.Text="No Connect"
End If
End Sub
Compiling in debug with my Samsung Galaxy A52 USB connected it works, and my textbox (L2) is updated every second.
I then tried to compile in release mode, and get pages of errors.
The first line says;
b4xmainpage_tmr_tick(Java line 153)
Android.os.networkonmainthreadexception
at android.os.stricktmode$androidblockguardpolicy.onnetwork(Stricktmoode.java:1668
Running B4A 11.8 on windows 10.
I'm new to B4A so any help would bee very kind.
By the way;
Your Paypal donation do not work..
best regards svein