无法从Android应用程序分享图像和文本到Facebook

时间:2014-06-03 12:51:58

标签: android facebook facebook-graph-api facebook-access-token

我已经制作了一个Android应用程序的演示程序,我想在app上分享文本和图像到facebook,我已经将应用程序与facebook集成,它给了我登录tto,但是给出了{{1}的错误} 所以,请帮帮我救我。我的代码如下:

"06-03 18:14:27.221: D/Request(21053): Warning: Sessionless Request needs token but missing either application ID or client token.

1 个答案:

答案 0 :(得分:0)

试试这个:

public void share(String friendID, String name, String caption,
        String description, String link, String picture,
        OnCompleteListener listener) {
    if (Session.getActiveSession() == null) {
        getSession();
    }
    Bundle params = new Bundle();
    params.putString("name", name);
    params.putString("caption", caption);
    params.putString("description", description);
    params.putString("link", link);
    params.putString("picture", picture);
    if (friendID != null)
        params.putString("to", friendID);

    WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(activity,
            Session.getActiveSession(), params)).setOnCompleteListener(
            listener).build();
    feedDialog.show();
}

public void getFriends(GraphUserListCallback callback) throws Exception {
    if (Session.getActiveSession() == null) {
        getSession();
    }
    if (Session.getActiveSession() == null)
        throw new Exception();
    Request.newMyFriendsRequest(Session.getActiveSession(), callback)
            .executeAsync();
}