Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
it's a teeny, tiny, wafer thin ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic