这是从服务器发送消息的方式:
//Queue Android GCM Notification
_pushService.QueueNotification(NotificationFactory.AndroidGcm()
.ForDeviceRegistrationId(device)
.WithCollapseKey("LATEST")
.WithJson("{\"alert\":\"" + message + "\",\"badge\":\"7\"}"));
我收到了意图,如何收到消息?我试过了:
Log.d(TAG, "" + intent.getStringExtra("{\"alert\":\""));
Log.d(TAG, "" + intent.getStringExtra("LATEST"));
Log.d(TAG, "" + intent.getStringExtra("data"));
所有都为空,是否为消息文本值的键?
答案 0 :(得分:3)
知道了,
Bundle b = intent.getExtras();
Set<String> allThatsInThere = b.keySet();