Ascorbin Ascorbin - 1 year ago 93
Android Question

Retrieve "content" of GCM message Intent.

This is how the message is being sent from the server:

//Queue Android GCM Notification
.WithJson("{\"alert\":\"" + message + "\",\"badge\":\"7\"}"));

I receive the Intent, how do I get the message? I tried:

Log.d(TAG, "" + intent.getStringExtra("{\"alert\":\""));
Log.d(TAG, "" + intent.getStringExtra("LATEST"));
Log.d(TAG, "" + intent.getStringExtra("data"));

All are null, whats the key for the message text value?

Answer Source

Got it, its

Bundle b = intent.getExtras();
Set<String> allThatsInThere = b.keySet();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download