Ascorbin Ascorbin - 1 month ago 18
Android Question

Retrieve "content" of GCM message Intent.

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

//Queue Android GCM Notification
_pushService.QueueNotification(NotificationFactory.AndroidGcm()
.ForDeviceRegistrationId(device)
.WithCollapseKey("LATEST")
.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

Got it, its

Bundle b = intent.getExtras();
Set<String> allThatsInThere = b.keySet();