basically i need a constant socket connected to a server that can be used in multiple activities. at this stage im trying to create and connect the socket on a login screen, where then a new activity starts, sets the input/output streams and then handles the data
im having alot of trouble trying to get the socket to persist in multiple activities. i have read into it and there is a lot of conflicting posts saying that services are better and a singleton is better. nonetheless i choose to try and implement a service. except i cant get it started.
i first tried to implement the code in the above link but it seems to depend on custom written code called TCPClient. not knowing the internals i moved onto the link below
Android service for TCP Sockets
needless to say ive gotten nowhere in understanding and following the Android resource hasnt really helped. according to the guy who posted the first link his code works, i just dont know whats inside the TCPClient class.
im trying to use the code from the second link, and adapt it for my app, but hasnt worked so far. right now im poking around in the dark.
ultimately, id like an explanation on how to get a tcp socket service started, or a better way to attempt this.
TIA