Android: Facebook image sharing problem on Friends Wall
I am having problem in sharing the images on friends wall by facebook api. the error is as follows.
"message": "(#240) Requires a valid user is specified (either via the session or via the API parameter for specifying the user."
my code is
String graphPath = null;
Bundle params = new Bundle();
params.putString("message", shortMsg.getText().toString());
TextView friendID = (TextView) shareToFriendDlg.findViewById(R.id.friendID_hiden_TextView);
params.putString("type", "photo");
params.putString("link",info.LINK);
params.putString("name",info.NAME);
params.putString("picture",info.PICTURE);
params.putString("caption",info.CAPTION);
params.putString("message", shortMsg.getText().toString());
params.putString("description", info.DESCRIPTION);
graphPath = friendID.getText().toString() + "/links";
mAsyncRunner.request(graphPath, params, "POST", new AsyncRequestListener() {
@Override
public void onComplete(JSONObject obj, 开发者_如何学编程Object state) {
Log.d("Sharing ", obj.toString());
Global.ApplicationActivity.runOnUiThread(new Runnable() {
public void run() {
shareToFriendDlg.dismiss();
Toast.makeText(Global.ApplicationActivity, "Shared :-)", Toast.LENGTH_LONG).show();
}
});
}
}, null);
The error message explains itself, You need to have a valid session with facebook to run this, first execute and create a valid facebook object with a valid sequence of permissions after having all these set up you can then proceed with image sharing implementation.
精彩评论