views:

1173

answers:

1

Hello people,

I am doing a project where I have too develop an application that listens for incoming events by a service. The device that has to listen too events is an Android phone with Android SDK 1.5 on it. Currently the services that call events only implement communication trough UDP or TCP sockets. I can solve my problem by setting up a ServerSocket, but i doubt that's the most power efficient way. This application will be running most of the time, with Wi-Fi on, and I'd like too reach an long battery duration. I've been looking for options on the internet for my question for a while but i couldn't get a real answer. I've got the following questions:

  • What is the most efficient way too listen to incoming events? Should I make an ServerSocket? or what are my options?
  • Are there any other implementations that are more power efficient?

Ive been also thinking of implementing communication trough XMPP. Not sure if this is the best way. I'm not forced too an specific implementation. All suggestions are welcome!

Thanks for the help,

Antek

+1  A: 

You already listed the possible choices. If the app has to be able to handle events, it also needs to be running all the time. afaik there is no push-notification-service that automatically calls your application, like on the iPhone.

I think using a protocol like XMPP is the most easy solution. Having your own ServerSocket would also mean the server has to send requests to different IPs whenever you are switching your network.

Ulrich Scheller