File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes C/S application - listener for a server remote call? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Android
Reply Bookmark "C/S application - listener for a server remote call?" Watch "C/S application - listener for a server remote call?" New topic
Author

C/S application - listener for a server remote call?

Marek Borshop
Greenhorn

Joined: Nov 26, 2010
Posts: 5
I'd like to know if there's any effective way how to deal with a situation when I need an Android client app to listen until it is called by a server - some kind of socket listener or so. I need the Android client app to be notified when server sends data, asynchronously. A simple example: I am running a chat service on server (Java app) and several Android clients connected and able to post messages. When any of the connected clients sends a message to the server, it processes it and notifies all other connected clients about this new post. Is there any effective way to do so? I do not much favor for the infinite loop workaround if there's better way. Thanks.
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi,

In your question only the answer is hidden. Use services in android. They runs in background even if the application is in pause state. You can right your code which has implementation of socket programming.
I ma not sure android supports socket programming or not.(But I think it should support). Java has reach library for socket programming. Use it.
 
IntelliJ Java IDE
 
subject: C/S application - listener for a server remote call?
 
Threads others viewed
transfer data from thread to threads
How to pass string from TCP server (a Runnable) to main activity (in Android)?
What comes out of the ObjectOutputStream is not what goes into the ObjectInputStream
Servlet server communication problems
Independent Serwer to Client (!) communication
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture