tags:

views:

629

answers:

2

I am developing an Android app that needs to communicate bi-directionally with a server. By that, I mean either the server or the device can send a message at any time, with an arbitrary amount of time in between messages. Sending data from the device to the server is a common and I think well understood task, but I'm not as sure what the best approach is to go in the opposite direction from the server to the device.

I think having the device periodically poll the server may be a bad idea due to latency and the drain on the battery, but I'd be willing to consider this option. My plan at the moment is to send text messages from the server via an email-to-SMS bridge, and to have my app run a service to receive and handle these messages.

The question I have is if there are any best practices for this scenario, and if using text messages has some downsides that I have failed to consider. For the sake of this question, I want to assume that users have an unlimited text data plan, so paying per text won't be an issue.

+10  A: 
Christopher
This sounds interesting, and I'll definitely look into it. Is XMPP preferable to SMS for any reason other than the fact that it would not actually use SMS messages?
ElectricDialect
I edited my original answer to include a whole load of stuff.
Christopher
Thanks for the extremely useful info about intercepting SMS messages!
ElectricDialect
A: 

I have tried to implement this but unfortunately i think the sms broadcast or any other system broadcast is a normal broadcast instead of ordered broadcast. We can create our own ordered broadcast but the android system might now have for example the PHONE_STATE intent received during a phone call is not an ordered broadcast and i have verified it as well. let me know if there are any system wide ordered broadcasts.

steven