title: Pass data from a service to current activity
body: <p>I'm building a chat application that uses GCM to push the messages and the notifications.</p>
  
  <p>In the app, I have an activity which lists the conversation threads (<code>ConversationListActivity</code>) and an activity which shows the conversation inside the thread (<code>ConversationActivity</code>).</p>
  
  <p>I capture new messages in GCMIntentService's onMessage method. The notification works and the message is recorded as expected.</p>
  
  <pre><code>public class GCMIntentService extends GCMBaseIntentService {
    @Override
    protected void onMessage(Context context, Intent intent) {
      Bundle extras = intent.getExtras();
      String sender = extras.getString("sender");
      String message = extras.getString("message");
  
      ConversationModel model = new ConversationModel(context);
      model.open();
      model.createMessage(sender, message.trim(), true, true, ConversationMessage.STATUS_SENT);
      model.close();
  
      this.createMessageNotification(context, sender, message);
    }
  }
  </code></pre>
  
  <p>The problem is, if GCM pushes a new message while <code>ConversationActivity</code> is active, I don't want it to generate a notification. Instead, I want the conversation to refresh directly.</p>
  
  <p>How can I tell the active <code>ConversationActivity</code> to refresh the message list every time there is a new message from GCM?</p>