分享图片和文字向Facebook上的android文字、图片、android、Facebook

2023-09-04 11:35:32 作者:听风暖

什么是android系统中共享图片和文字给Facebook正确的方法是什么? 例如画面,pre填充的文本。

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

我知道这是不可能的,从原生的Andr​​oid份额意图描述这里。因为它只能拍摄图像或链路不能同时使用。

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");

通过饲料对话框(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.

 
精彩推荐