Hi .
How can i publish photos to friends timeline using the userid of particular user. I tried a lot but i am getting error like
"error":{"message":"(#200) This app is not allowed to publish to other users' timelines.","type":"OAuthException","code":200}}
message - (#200) This app is not allowed to publish to other users' timelines.
I allowed all permissions in my app. For videos its publishing. For the status message and photos i am getting the error.
Please help me in solve this issue.
My code.
public class Users {
public static void main(String[] args){
try {
Facebook facebook = new FacebookFactory().getInstance();
String userid = null;
String query = "SELECT uid ,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user=1";
JSONArray jsonArray = facebook.executeFQL(query);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject;
try {
jsonObject = jsonArray.getJSONObject(i);
System.out.println(jsonObject);
userid = jsonObject.getString("uid");
System.out.println(userid);
} catch (JSONException e) {
e.printStackTrace();
}
}
Media m1=new Media(new File("image loc."));
String postid= facebook.postPhoto("userid of friend", m1);
System.out.println(postid);
facebook.postStatusMessage("userid of friend.","Hello...");
} catch (FacebookException e) {
e.printStackTrace();
}
}
}
I am passing app id, app secret and accesstoken through facebook4j.props file.