title: What are the best practices on creating a chat app in android
body: <p>I am going to create an android chat app.  Actually chat is going to be a feature of the app.  I want to know what are the best practices regarding chat apps with android.  The two options that I am familiar with are C2MD and just a custom polling of the server db every few seconds.</p>
  
  <p>Now, I know that C2MD is supposed to be great and all, but from my understanding it is not that reliable.  I have tried to implement it and it does not seem to be working.  Also, if for some reason something happens on googles end(like their servers are down - not likely but could happen) I have no way to contact them, and am at their time frame.</p>
  
  <p>Now if I do my own thing (a basic approach where I send the message that the user creates, and then periodically check the server to see if any new messages have arrived) seems ok except, in order to have a decent user experience, my polling of my server would have to be like ever 5 seconds or so, and that is going to chew up battery like crazy.  This is really my main drawback from using this approach.</p>
  
  <p>So, I am wondering there is a better way out there that I am not aware of.  Please any help, architecture structures, anything would be helpful.</p>