GCM和App Engine聊天应用程序 [英] GCM and App Engine for chat application

查看:120
本文介绍了GCM和App Engine聊天应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划制作一个聊天应用,用户可以通过它发送和接收文本和媒体 - 音频,图像和视频。为了简单起见,我决定将app引擎与GCM结合使用。使用GCM提供的示例指南和Android Studio模板,GCM似乎运行良好(用于短信)。当我尝试上游时,我没有收到消息。可能这是非常微不足道的,但有人可以请我指出一个很好的教程或书籍。任何建议?

I am planning to make a chat app through which user can send and receive text and media - audio, image and video. For simplicity I decided to use app engine with GCM. Doing downstream with GCM seems to be working well (for text messages) using the example guide provided and Android Studio template. When I tried upstream I did not receive the message back. May be this is very trivial but can someone please point me to a good tutorial or book on this. Any suggestions?

用于下游: https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints
此为上游: https://developers.google.com/cloud-messaging/upstream

推荐答案

我必须在通过Studio模板生成的MessagingEndpoint类中将
@ApiMethod(name =sendMessage)
添加到sendMessage方法中。之后,我可以使用sendMessage api将消息发送回与GCM链接的应用程序引擎服务器,并且该消息也回传给我的设备。

I had to add @ApiMethod(name = "sendMessage") to sendMessage method in MessagingEndpoint class generated through Studio template. After that I was able to use the sendMessage api to send the message back to app engine server which is linked to GCM and that message echoed back to my device as well.

这篇关于GCM和App Engine聊天应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆