Acces GCM Payload from Launched Intent
<p>When a GCM notification is clicked, my app launches its main activity. However, I need to access some of the data from the notification. Since the intent is launched from the payload itself, I don't know where I could add a bundle to incorporate and pass the data. The onResume of the activity: </p>

<pre><code>@Override
public void onResume(){super.onResume();
if (getIntent().getAction() == "OPEN_ACTIVITY1") {
    Log.d("Look Here", "Called");
    String to = intent.getString("to");
    notificationlaunched = true;
    Fragment mFragment = new ChallengeFragment();
    final Bundle bundle = new Bundle();


    Log.d("to", to);
String challenge = "";
    bundle.putString("to", to);
    bundle.putString("challenge", challenge);
    mFragment.setArguments(bundle);
    FragmentTransaction transaction =      getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.fragment, mFragment);
    transaction.addToBackStack(null);
    transaction.commit();

}
}
</code></pre>

<p>An example message:</p>

<pre><code>May 13, 2016 11:08:33 PM com.gcm.samples.friendlyping.GcmServer send
INFO: sending msg: &lt;message&gt;&lt;gcm xmlns="google:mobile:data"&gt;{"data":{"action":"ping_client","sender":"clzeqRiwDqw:APA91bFK2l6DezSXtL0v4zqnU7-L_0EZ6vjQjbbkH59jay4mGemr9mIDwf3jvlLoCDQhaJIlkCBQLZKIQoYtCzJgvcd9owYcF1oIDndaaCM6BqHwjCBM4hTbvtyTta6sS5UIhD6VcR4G"},"notification":{"body":"John Smith","num":"chmm","title":"App Title","icon":"mipmap/ic_launcher","action":"ping_client","sound":"default","click_action":"OPEN_ACTIVITY1"},"to":"dZ4JkLMxhcU:APA91bGe2fdnOiqeZbHBr7ZxX21VmSQxz5xmbtJLsyccwNbVvZP9Ln5mL3DN4ErLk0HLfuxszZgGFytmuG-GJ7kl21Hk_d1QN1qbyfc5m_KDTsX1SKAW9lEkEAit7gYulUe3Bhb9RN_l","message_id":"1463195313920"}&lt;/gcm&gt;&lt;/message&gt;
</code></pre>

<p>getString("to") is null. The intent is in the manifest. How can I get information from this message?
Thanks for any help.</p>