2

这是从服务器发送消息的方式:

        //Queue Android GCM Notification
        _pushService.QueueNotification(NotificationFactory.AndroidGcm()
            .ForDeviceRegistrationId(device)
            .WithCollapseKey("LATEST")
            .WithJson("{\"alert\":\"" + message + "\",\"badge\":\"7\"}"));

我收到 Intent,如何获取消息?我试过了:

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

全部为空,消息文本值的键是什么?

4

1 回答 1

3

明白了,它的

Bundle b = intent.getExtras();
Set<String> allThatsInThere = b.keySet();
于 2013-02-22T10:02:16.107 回答