Android Question Socket communication problem

gruizelgruis

Member
Licensed User
Longtime User
Hi,

I'm using socket to communicate with my visualbasic program its much like discussed ini this thread:
https://www.b4x.com/android/forum/threads/socket-send-works-but-cant-get-text-back.16563/#post-95908

I use multiple activities, and cant figure out how to use the socket communication on a global scale.
I have setup and a working connection on my main activity. But I realy need to send/resieve data from an other activity.

I like to have a global "sendata" sub. That I can call from any activity.
And I prevere to have a custom #event: That gets triggerd when data arrives on that activity.

PLease advice
 

gruizelgruis

Member
Licensed User
Longtime User
Found it

Maybe some use to others

I needed to create a service module. And start that module using its module name from an activity

Sub Activity_Create(FirstTime As Boolean)
StartService(service_Module_Name)
...... more code
End Sub

Second thing I like to pointout is that the 'service module' Service_Create routine gets started after the tread (in the activity) is finished .

Sub Activity_Resume
... a bit more code

'// service module starts when this is finished
end sub
 
Upvote 0
Top