发送使用GCM声音文件或图片的推送通知声音文件、通知、图片、GCM

由网友(照样乱了阵脚)分享简介:我工作的推送通知GCM的机器人。我与基本功能做手段,我发短信,并接受其作为通知的Andr​​oid设备。现在,我想送的声音和图像文件,这将是我在Android的通知。有没有办法做到这一点,因为GCM允许大小为4KB的消息,我没有看到任何例子,其中一个图像或声音发出的通知。任何帮助或链接或教程将AP preciated。...

我工作的推送通知GCM的机器人。我与基本功能做手段,我发短信,并接受其作为通知的Andr​​oid设备。现在,我想送的声音和图像文件,这将是我在Android的通知。有没有办法做到这一点,因为GCM允许大小为4KB的消息,我没有看到任何例子,其中一个图像或声音发出的通知。任何帮助或链接或教程将AP preciated。

I am working on Push Notification GCM in android. I am done with basic functionality means at that i am sending a text message and receiving it as notification on android device. Now i want to send sound and image file which will be my notification on android. is there any way to do it because GCM allows message of size 4kb and i don't see any example in which an image or sound is sending as notification . Any help or link or tutorial would be appreciated.

推荐答案

您说得对大小限制。它是4KB,并且可以没有任何大。如果您需要发送图像/声音或其他二进制数据,发送自定义的JSON与指向,里面的二进制数据的URL(比如消息http://myserver.com/mysoundfile.ext )。

You're right about the size limit. It is 4kb and cannot be any larger. If you need to send an image / sound or other binary data, send custom json with the message that points to a URL that houses the binary data (say http://myserver.com/mysoundfile.ext).

您的自定义 GCMIntentService 可以分析数据,并通过的AsyncTask 下载文件。如果文件较大使用下载管理器服务。

Your custom GCMIntentService can parse the data and download the file through an AsyncTask. If the file size is large use the DownloadManager service.

阅读全文

相关推荐

最新文章