如何获得许可后才能上传照片,并在Facebook上发布 [英] How to get permission to upload photo and publish on Facebook

查看:214
本文介绍了如何获得许可后才能上传照片,并在Facebook上发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个Facebook sharedialog来分享信息和图像拍摄格式的URL的网络资源(FB方法是

  setPicture(URL字符串))。

不过,我希望用户能够从SD卡上传图像。
所以我通过映像路径到一个文件

  Request.newUploadPhotoRequest(会话,imageSelected,uploadPhotoRequestCallback);

方法。

然后我得到的回调URL,并通过这的的setPicture(URL)
FacebookDialog.ShareDialogBu​​ilder对象。

问题是用户必须首先批准在FB相册中的照片在他们的时间线,分享,然后让URL变得可通过setPicture后()。

消息我在Facebook上获得:


  

您希望这些照片添加到您的专辑?下面的照片
  从另一个应用程序被上传,你需要审批。


所以,我想知道这是一个权限问题,如果让我怎么去获得所需的权限?

我不熟悉的Facebook SDK和SSO,但使用共享对话框时,如果用户已经FB应用权限在第一次登录时要求,此后不是必需的。

无法理解我如何使用共享对话框来发布网络资源,但无法上传照片。

会议code我用的是:

//打开会话协议,以每股FB对话框上的说明

  //启动会话
Session.openActiveSession(这一点,真正的,新的Session.StatusCallback(){@覆盖
公共无效电话(最后一届会议,SessionState会状态,异常除外){
//回调时,会话状态变化
//要求上传照片
//使用共享对话框发布图片的网址


解决方案

在通过谷歌和FB开发者的网站搜索的时间是添加此code的mtter:
//请求addtional权限上传照片
                             Session.NewPermissionsRequest

  newPermissionsRequest =新的Session
                                      .NewPermissionsRequest(LogDive.this,Arrays.asList(publish_actions,publish_stream));
                                    session.requestNewPublishPermissions(newPermissionsRequest);

FB开发者网站非常混乱的问候使用共享对话框概述基本权限。

I am using a FaceBook sharedialog to share a post and image taken form a URL network resource (FB method is

setPicture(URL string)).

However I want the user to be able to upload a image from the SD card. So I passed a file of image path to the

Request.newUploadPhotoRequest(session, imageSelected, uploadPhotoRequestCallback);

method.

I then get the URL in the callback and pass this to the setPicture(URL) of the FacebookDialog.ShareDialogBuilder object.

Problem is user must first approve the photo in the FB album to share in their time line and then have the URL become available to post via setPicture().

the message I get in Facebook:

Would you like to add these photos to your album? The photos below were uploaded from another application, you'll need to approve them.

So I am wondering is this a permissions issue, and if so how do I go about getting the permission required?

I am unfamiliar with Facebook SDK and SSO, but when using the share dialog if user has FB app permissions are asked at first login and not required thereafter.

Cant understand how I can use share dialog to post a network resource but not upload a photo.

The session code I use is:

//open a session accord to FB share dialog instructions

//start a session 
Session.openActiveSession(this, true, new Session.StatusCallback() { 



@Override 
public void call(final Session session, SessionState state, Exception exception) { 
//callback when session changes state 
//request a photo upload
//use share dialog to post the URL of image

解决方案

After hours of searching through google and FB developers site it was a mtter of adding this code: //request addtional permissions to upload photos Session.NewPermissionsRequest

newPermissionsRequest = new Session
                                      .NewPermissionsRequest(LogDive.this, Arrays.asList("publish_actions", "publish_stream"));
                                    session.requestNewPublishPermissions(newPermissionsRequest);

FB developers site very confusing with regards to outlining basic permissions using share dialog.

这篇关于如何获得许可后才能上传照片,并在Facebook上发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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