GCM发送短信的形象,而不是发送短信、而不是、形象、GCM

2023-09-12 10:23:08 作者:風帶走故事也帶走妳

我是一个Android的新手,而我使用的谷歌GCM发送纯文本邮件。是否有可能发图片的文件流或者其他方法?

I'm an Android newbie, and I'm using Google GCM to send a plain text message. Is it possible to send an image file as stream or by some other method?

爪哇 - 服务器

Android的 - 客户端

Android - Client.

    Message message = new Message.Builder()
                .collapseKey("1")
                .timeToLive(3)
                .delayWhileIdle(true)
                .addData("TEST",
                        "Hello Android")
                .build();

下面的平原消息 .addData(TEST,你好Android的)

推荐答案

我写一篇关于如何做到这两个博客的帖子:

I wrote two blogs posts on how to do this:

教程:使用AirBop发送图像的消息负载说明如何通过Base64编码的图像做

Tutorial: Using AirBop to Send Images in the Message Payload which shows you how to do it by base64 encoding the image.

教程:使用AirBop推动BigPictureStyle通知这表明你如何把图像的URL,然后下载的图片图像。

Tutorial: Using AirBop to Push Images for BigPictureStyle Notifications which shows you how to push image urls and then download the image.

这两个教程使用AirBop作为应用程序服务器,但客户端code是分开的,并且可以被一般使用。

Both tutorials use AirBop as the Application server, but the client code is separate from that and can be used generically.