title: GCM Push message to update UI when foreground and post notification when background. How to implement this?
body: <p>I have received the GCM push Message. </p>
  
  <p>How to decide whether I have to update the UI or post a notification. </p>
  
  <p>If our app is in foreground then we can update the UI. If our app is not running then I need to post a notification. Whether this is the right way. Or else any other way to handle it. And how can I find that my app is in foreground or background. </p>
  
  <p>Thanks in advance. </p>