在Android上分享图片和文字到Facebook [英] Share Image and Text to Facebook on android

查看:393
本文介绍了在Android上分享图片和文字到Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android中分享图片和文字到Facebook的正确方法是什么?
例如图片与预先填充的文本。

What is the correct way to share an image and text to Facebook in android? e.g. picture with pre-populated text.

我意识到,这是不可能的原生Android共享意图,如这里。因为它只能采取图像或链接不是两者。

I realise that this is not possible from the native Android share intent as described here. As it can only take an image or a link not both.

另外我已经尝试使用facebook-sdk-3.14与:

Also I have tried using the facebook-sdk-3.14 with:

    FacebookDialog.ShareDialogBuilder 

但我现在意识到这只是为了共享链接。

but I now realise this is for sharing links only.

我也尝试过:

    createShareDialogBuilderForPhoto() 

但这只是为了分享图片。

but this is for sharing images only.

有没有什么我在sdk中缺少?我猜测这是不可能的FacebookDialog?

Is there something I am missing in the sdk? I am guessing it is not possible from FacebookDialog?

我需要去创建自己的应用程序在Facebook和我自己的开放图形动作的路线?理想情况下,我希望没有登录按钮

Will I need to go the route of creating my own app in facebook and my own open graph action? Ideally I am looking to not have a login button.

我也看过类似的问题,但大多数是关于分享意图,或者是sdk至少一年过期,解决方案是类似于此的一些事情:

I have also seen similar questions but most are about the share intent or if it is the sdk it at least a year out of date and the solution is some thing similar to this:

    Bundle parameters = new Bundle();
            parameters.putString("message", category_item_name_desc.getText().toString());
            parameters.putString("picture", categoryItemsModel.getImageUrl());
            parameters.putString("caption", txtDescription_desc.getText().toString());
            facebook.request("/me/feed", parameters, "POST");

通过Feed对话框(WebDialog)尝试,但是我得到一个错误(#324)需要上传文件,任何帮助都会很棒。

Tried it through the Feed Dialog (WebDialog) but im getting a "error (#324) requires upload file", Any help would be great.

推荐答案

能够使用目前的Facebook SDK(3.14.1在那个时候)没有登录,我把它变成一个共享意图添加到选择器列表。

Was able to do this my self with the current Facebook SDK (3.14.1 at the time) with no login and I made it into a share intent for adding to the chooser list.

我有一个演示项目在 https://github.com/b099l3/FacebookImageShareIntent 只有依赖关系是facebook sdk,它包含在一个活动中。

I have a demo project at https://github.com/b099l3/FacebookImageShareIntent only dependency is the facebook sdk and it is contained in one activity.

这篇关于在Android上分享图片和文字到Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆