Send client response in GCM

时间:2016-04-04 18:03:06

标签: google-cloud-messaging

I've been playing with Google Cloud Messaging and works pretty fine, but I haven't found a way of responding a received message. I receive the message from server, but only can process it:

@Override
public void onMessageReceived(String from, Bundle data) {
    String message = data.getString("message");

    // Display notification
    sendNotification(message);
}

How can I send back a response?

1 个答案:

答案 0 :(得分:0)

Monkiki,

You've run into the fundamental flaw in all of the push notifications (GCM & APNS) which is that it is only ONE WAY. There is no concept of a "RESPONSE" because there is no concept of a conversation or session of any kind - each message is independent.

Now, there are the concepts of "upstream Messages" that GCM supports, but then you'll be managing all of the details related to a "conversation" - from ensuring that the messages are delivered in the right order, conversation history and the rest of it.

** Warning - shameless plug **

I work at a company called Magnet Systems and we've built our product Magnet Message precisely designed to allow multi-way communication - user-to-user, groups, channels - to handle all of the nitty gritty. We even allow you to support huge attachments and large payloads - which goes well beyond the limitations of 4K that GCM limits you to.

Anyways, Check it out at http://developer.magnet.com.