发送使用GCM声音文件或图片的推送通知 [英] Send a Sound file or Image as Push Notification using GCM

查看:440
本文介绍了发送使用GCM声音文件或图片的推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的推送通知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.

这篇关于发送使用GCM声音文件或图片的推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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