facebook在Android中集成,发布所有帐户的照片
问题描述:
我已经添加Facebook到我的Android应用程序共享图像,现在的事情是,只能从我的Facebook帐户完成共享,只要我尝试从另一个帐户登录,我不能发布任何图片这是我使用的代码片段。任何帮助表示赞赏 `facebook在Android中集成,发布所有帐户的照片
Request uploadRequest = Request.newUploadPhotoRequest(
Session.getActiveSession(), bmp, new Request.Callback() {
@Override
public void onCompleted(Response response) {
Toast.makeText(FacebookUpload.this,
"Photo uploaded successfully",
Toast.LENGTH_LONG).show();
`
有一部分LYK这
`public void postImage() {
if (checkPermissions()) {
Bitmap bmp = null;
String filename = getIntent().getStringExtra("image");
try {
FileInputStream is = this.openFileInput(filename);
bmp = BitmapFactory.decodeStream(is);
is.close();
} catch (Exception e) {
e.printStackTrace();
}
Request uploadRequest = Request.newUploadPhotoRequest(
Session.getActiveSession(), bmp, new Request.Callback() {
@Override
public void onCompleted(Response response) {
Toast.makeText(FacebookUpload.this,
"Photo uploaded successfully",
Toast.LENGTH_LONG).show();
File dir = getFilesDir();
File file = new File(dir, "bitmap.png");
file.delete();
}
});
// post on user's wall.
Bundle params =uploadRequest.getParameters();
Random rand = new Random();
int rndInt = rand.nextInt(3)+1;
if(rndInt==1)
params.putString("name", "download Chummi-Lalli Mobile App from https://play.google.com/store/apps/details?id=com.interactive8.readmestories");
else if(rndInt==2)
params.putString("name","Send gifts to your loved ones from www.ekhudol.com");
else if(rndInt==3)
params.putString("name","Chummilalli brought to you by www.3leafsolutions.co.in");
else
params.putString("name","Chummilalli brought to you by www.3leafsolutions.co.in");
uploadRequest.setParameters(params);
uploadRequest.executeAsync();
}
else
requestPermissions();
}`
n只要我使用另一个帐户我我的代码总是转到这个else部分requestPermission()为什么我总是在这里重定向,一切正常,当我使用我自己的Facebook帐户
答
这真的很简单,我不得不做任何事情,但只是子我的应用程序fb,我并不知道关于开发者网站上的这一步,我想通了,现在我的应用程序工作得很好,虽然
我想,你可能犯了一些逻辑错误。在图像上传之前检查你的代码两次。 – RAAAAM 2014-10-28 11:02:04
@Hari Ram你可以给我一个线索,我应该检查,我已经提供给所有用户从Facebook开发者页面的应用程序,这不应该是足够的,如果有问题,那么它不应该工作无论哪个帐户我从ryt登录? – sapamlucy 2014-10-29 05:11:34
嗨,让我看看完整的代码。 – Sakthi 2014-11-18 06:13:53