1

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..

vinay Maneti
  • 1,447
  • 1
  • 23
  • 31

2 Answers2

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