title: Android GCM - "Handling Received Data"
body: <p>Android documentation for GCM <a href="http://pages.citebite.com/e3s6b5w4ecev" rel="nofollow">here</a> states </p>
  
  <blockquote>
    <p>that key-pair values in the data parameter, they are available as
    extras in this intent, with the keys being the extra names.</p>
  </blockquote>
  
  <pre><code>private void handleMessage(Intent intent) {
      // server sent 2 key-value pairs, score and time
      String score = intent.getExtra("score");
      String time = intent.getExtra("time");
      // generates a system notification to display the score and time
  }
  </code></pre>
  
  <p>But intent.getExtra() method does not accept an argument </p>
  
  <pre><code>public Bundle getExtras ()
  
  Since: API Level 1
  Retrieves a map of extended data from the intent.
  
  Returns
  the map of all extras previously added with putExtra(), or null if none have been added.
  </code></pre>
  
  <p><strong>MyQuestion</strong></p>
  
  <p>How to retrieve a 'String' from the GCM message in <code>onMessage()</code> method?</p>
  
  <p>P.S <code>onMessage(Context context, Intent intent): Called when your server sends a message to GCM, and GCM delivers it to the device. If the message has a payload, its contents are available as extras in the intent.</code></p>