将图像从相机或图库上传到Facebook墙壁代码android

时间:2012-02-13 11:48:37

标签: android facebook facebook-graph-api

我是新手facebook sdk.i希望通过应用程序上传图像从相机或画廊到脸谱墙。我有像这样的wriiten代码,但它不工作。请帮助我任何帮助将不胜感激。 我已经给了这个许可:

private static final String[] PERMISSIONS = new String[] {"user_photos","publish_stream", "read_stream", "offline_access","photo_upload"};

我的发布代码是这样的:

    AsyncFacebookRunner mAsyncFbRunner = new AsyncFacebookRunner(mFacebook);

    Bundle params = new Bundle();


    params.putString("method", "photos.upload");
    params.putByteArray("picture", photoId);

    mAsyncFbRunner.request("me/photos", params, "POST", new WallPostListener());

但它不适合我。请帮助我

1 个答案:

答案 0 :(得分:0)

试试这个LINK

它可能对你有所帮助。

,另一种方式是

Bundle params = new Bundle();

String attachment="{\"name\":\""+Title+"\"," +
                "\"href\":\"Title Link.\"," +
                "\"caption\":\""+Fb Caption Message+"\",\"description\":" +
                "\""+ImageDescription+"\",\"media\":" +
                "[{\"type\":\"image\",\"src\":" +
                "\""+Image_url+"\"," +
                "\"Linkable URL Path\":" +
                ".\"}}}";

params.putString("attachment",attachment.toString());

我在我的一个应用程序中使用这种方式。