How to attach the image in push notification with Google Cloud Messaging ..Is it is possible to attach image, can any one tell how to attach..(or) it is possible like attach image in the form of URL/Text.. please provide me some sample example..
Asked
Active
Viewed 2,656 times
1
-
No men it's not possible better to used `Parse` or `Urbenship` third party Notifications – M D Apr 16 '14 at 13:14
-
can you tell me.As i'm new to this concept can you provide me some sample example.. – vinay Maneti Apr 16 '14 at 13:15
-
Go to official [docs](http://developer.android.com/google/gcm/adv.html) – M D Apr 16 '14 at 13:19
-
1possible duplicate of [GCM send image instead of message](http://stackoverflow.com/questions/15436624/gcm-send-image-instead-of-message) – Eran Apr 16 '14 at 13:57
-
@eran i have seen that seen that i can't understand and even the links are not working in that.. – vinay Maneti Apr 16 '14 at 15:29
-
@vinayManeti There are working links in the comments – Eran Apr 16 '14 at 15:30
2 Answers
1
Maximum size of the push message can be upto 4KB. Therefore it is recommended to put the image on server somewhere and pass the url link of that image via push.

Sunny Garg
- 1,073
- 1
- 6
- 13
0
I don't think that's the correct approach. Each GCM
message is limited to 4KB
of data, so unless you want to send messages as it was somekind of TCP
protocol, you shouldn't use it.
Sending images is probably better to be done with a HTTP POST
request to the remote server (as the GCM
architecture requires), and afterwards process it.

nKn
- 13,691
- 9
- 45
- 62
-
Sure, take a look at: http://stackoverflow.com/questions/2935946/sending-images-using-http-post – nKn Apr 16 '14 at 13:20
-
i have followed this tutorial to send the message http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/ – vinay Maneti Apr 16 '14 at 13:25
-
Sure, you'll have to process that request in the server side written in `PHP`, but you want to send it through an `Android` app, if I understood it correctly. Have a look at this: http://www.php.net/manual/en/features.file-upload.php – nKn Apr 16 '14 at 13:27