Posting attachment without open dialog using Facebook Android SDK?
I am working on Facebook Integration in my Android app. I am able to send attachment by using "stream.publish" with opening dialog. Is there a way to post without opening dialog? I am using following method.
Please give me any idea.
postParams.put("seriesname", "Commented during the TV show"+" '"+series+"'");
postParams.put("description", text);
parameters.putString("attachment", "{\"name\":\""+postParams.get("seriesname")+"\","
+"\"href\":\""+"http://www.google.com\","+"\"description\":\""+postParams.get("description")+"\"}");
mFacebook.dialog(FacebookComments.this, "stream.publish", parameters, new SampleDialogListener());
Log.d("FACEBOOK RESPONSE", response);
if (response == null || response.equals("")
|| response.equals("false")) {
Log.v("Error", "Blank response");
}
}
} catch (Exception e) {
Log.e("Facebook", "Error开发者_StackOverflow: " + e.getMessage());
}
}
Check this code for Posting in Facebook wall without Dialog :
public boolean postOnWall(String msg) {
Log.d("Tests", "Testing graph API wall post");
try {
String response;
Bundle parameters = new Bundle();
parameters.putString("message", msg);
parameters.putString("description", "test test test");
parameters.putString("tags",person_id);
response = ZValues.authenticatedFacebook.request("me/feed", parameters,"POST");
Log.d("Tests", "got response: " + response);
if (response == null || response.equals("") || response.equals("false")) {
Log.v("Error", "Blank response");
return false;
}
} catch(Exception e) {
e.printStackTrace();
}
return true;
}
Check this for sending links in Post
精彩评论