【发布时间】:2013-07-01 14:14:05
【问题描述】:
我正在开发一个 Android 应用程序,它可以让您发布故事,我希望用户上传照片。
该应用具有“publish_actions”权限,并且具有“user_generated”、“fb:explicitly_shared”。
我的代码如下
ByteArrayOutputStream stream = new ByteArrayOutputStream();
if(bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)) {
Log.i(TAG,"Bitmap compressed into stream successfully.");
}
postParams.putByteArray("image", stream.toByteArray());
postParams.putString("user_generated", "true");
postParams.putString(OBJECT,URL);
postParams.putString("fb:explicitly_shared", "true");
Log.i(TAG,"Executing facebook graph story request...");
Request request = new Request(session, "me/<appnamespace>:<action>", postParams, HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
当我检查测试帐户时间线时,故事已发布,但没有图像。我想问题出在这一行:
postParams.putByteArray("image", stream.toByteArray());
我认为问题在于关键不是“图像”,或者不是你这样做的方式。
这样做的正确方法是什么?
【问题讨论】:
标签: android facebook facebook-opengraph