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.
Asked
Active
Viewed 6,918 times
2
-
check [this question](http://stackoverflow.com/questions/15436624/gcm-send-image-instead-of-message/15436728#15436728) – Eran Apr 13 '13 at 13:01
1 Answers
9
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).
Your custom GCMIntentService
can parse the data and download the file through an AsyncTask
. If the file size is large use the DownloadManager
service.

Deepak Bala
- 11,095
- 2
- 38
- 49
-
Here is an example of a minimal `AsyncTask` to add in the `onMessage` method of the `GCMIntentService`: http://stackoverflow.com/a/17398749/418831 – Jonathan Maim Aug 19 '14 at 12:26