Android Question Socket communication problem

Discussion in 'Android Questions' started by gruizelgruis, Feb 19, 2015.

  1. gruizelgruis

    gruizelgruis Member Licensed User

    Hi,

    I'm using socket to communicate with my visualbasic program its much like discussed ini this thread:
    http://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
     
  2. gruizelgruis

    gruizelgruis Member Licensed 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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice