How to send image using gcm in android? - google-cloud-messaging

I am working on a project which will implement chat feature. I am using GCM to send message and working fine. But i want to send image just like facebook chat. After searching google i found that we can send image by encoding the image into base64 string. But the message size of gcm is up to 4kb so i can not send image like that. Here i need to upload the image into server and then needs to send the user a link and fetch the image from that link. But i think this will be a slow process . What can i do know?
I am sending message to others directly from my device using gcm. Please help me. I already found AirBop. But is there any other solution to send image?

you have to upload the image without GCM, On your server you have to had application that read the file from your device (Via Socket), and return the URL of the saved image, then the device send a link via gcm (as text) the partner gets the link and download the image.

Related

How to send videos as attachment in chat message Quickblox Android App?

I have integrated Quickblox Android SDK into my app for chat module.
Images as an attachment is possible. But I can't find any working solution to make a video attachment file under the same request.
I have confirmed by reading a document from Quickblox which says - Video attachment possible under Quickblox chat SDK.
Do anyone has any working solution to make video file attachment with this?
Thanks in advance!
You just need a pass file it doesn't matter its image or video, like you're passing image file.
further process is same

Can I send videos to android devices using gcm?

If not please suggest me how to send videos to android devices using c#. Earlier I have succeeded using gcm I easily sent out pushnotifications to android devices. My doubt is can I sent videos to android devices using gcm?
As per my earlier comment, it is not possible to send large files via GCM (nor FCM) due to the payload size limit.
What I think you can use instead is make use of Firebase Storage, store the video from there, in the push notification, you can send a download URL, which your client app should handle.

Chat App: Images through Websocket? Or REST endpoint?

Let's say we have a chat app and we want users to be able to send images.
Would it be appropriate to convert the image to Base64 in order to send the image through the websocket? A few posts I was reading mentioned this wouldn't be a good use of websockets, so would it be better to have an endpoint for images, and tie that image to the message on upload completion?
Totally new to websockets, so I'm not really sure what to do here.
You can use XMLHttpRequest for file upload and then send the link along with the data through websocket.
Uploading file through websocket will require extra code at the server side to convert the received data to files.
Also check http://binaryjs.com/
BinaryJS is bidrectional realtime binary data with binary websockets
As of today, XMLHttpRequest is the standard most of the companies are using for the file upload, some of the reasons for choosing HTTP are support for caching, gzipping, authentication, firewall, browser compatibility and horizontal scaling.

android gcm push doesn't work with json tag notification

I create an android gcm client. I read this guide:
https://developers.google.com/cloud-messaging/android/client and i use this example https://github.com/googlesamples/google-services/tree/master/android/gcm
My app workes, it receives Push but only when our server application sends json with "data payload".. when our server sends json message with notification payload my android app does'nt receive push.
I read: "Use notifications when you want GCM to handle displaying a notification on your Android client app’s behalf," but it doesn't work in Android...
From what I can guess, you probably just don't have the icon key in your json which is required for Android but not for iOS, try to add something like "icon" : "#drawable/myIcon.png" in your notification dictionary. (I would have asked for a sample of your Json in the comment instead of guessing if I could but I'm still pretty new and can't comment everything yet).

DropBox core API how to get GPS metadata for each image?

I am using Core Api from drop box to upload and download file. The upload and download take place from my device. So the image is stored locally and then uploaded. And when downloaded they store on device and I pull them from their locations.
I am able to access the metaData dropBox provides via the restClient LoadedMetaData method. However that method doesn't provide support for the GPS. In this blog Post from dropBox https://www.dropbox.com/developers/blog/86/new-additional-information-about-photo-and-video-files
it has an update to access this. But it is done using a GET HTTP request. Can I do this from inside xcode? I tried accessing the request directly and it gives an error of "NO AUTH" so I cant grab the JSON file. But we should already be authorized from signing in directly with the api.
Any help would be so appreciated.
I believe that in the Core SDK, you can just call [client loadMetadata:path withParams:#{#"include_media_info": #"true"}];
(Caveat: I haven't tested it myself. Please let me know if it works.)