I have a question in socket programming in android. I have an application that communicates to a server using iq stanzas. I want my application to READ ONLY the socket's inputstream when NEW DATA is available for fetching. Currently, what I did is, I create a timer that scheduled for the reading of socket's inputstream every 1second. This is not that good because it will end up of reading the socket even if there's no available data. And it drains the battery fast.
Is there an API for android that will tell or send a flag to the client that is connected to a socket whenever a new data is available so that it is the only time I will read the inputstream?
Thank you in advance...





