send message as status without a dialog : Android Facebook
I am working on an Android app wh开发者_高级运维ere we enter some text in edit box and all I want to do is simply send the text which typed (i.e.., edittext.gettext()) to facebook as my status.
The important thing is I don't want a Facebook dialog box to open, just send the message as status without a dialog box.
Is there any way I could post without using dialog box?
Hey man. The Graph API is really good. look into me and feed.
download the files form the github, Facebook.java, AsyncFacebookRunner.java, etc...
for example in your ShareOnFacebook.java:
public void postToWall(String message) {
Bundle params = new Bundle();
params.putString("message", message);
// Uses the Facebook Graph API
try {
facebook.request("/me/feed", params, "POST");
this.finish();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
You can use Facebook's Graph API for this; Android has JSON serialization classes available in the org.json
package. The only part of reasonable complexity is authorization/authentication, for which there's documentation here.
You may also have luck using the Facebook's SDK for Android.
精彩评论