Reputation: 837
All the samples I have seen so far seem to be using an earlier version of the SDK and the parameters and calls don't match. Using the latest SDK, I'm trying this:
String access_token = facebook.getAccessToken();
Bundle bundle = new Bundle();
bundle.putString("access_token", access_token);
bundle.putString("app_id", FACEBOOK_APP_ID);
bundle.putString("message", "My First Post");
bundle.putString("description", "My First Description");
asyncrunner.request("me/feed", bundle, new RequestListener() {
And i get back a call to onComplete() with response = "{"data":[]}.
And nothing ever gets posted to my wall on FB. Perhaps I'm not waiting long enough? How long should I need to wait before it shows up?
Upvotes: 1
Views: 705
Reputation: 11
you could try doing the following
mAsyncRunner = new AsyncFacebookRunner(facebook);
Bundle params = new Bundle();
params.putString("message", "I am playing MegaCandy mobile right now!!");
mAsyncRunner.request("me/feed", params, "POST", new TestRequestListener(), null);
That will solve your issue of posting using the Graph API. I know that if the http method is post, then you should add the message as a byte[] but this is the only way I got it to work properly.
You will still get the class cast exception for several fields (like message, format and access_token) but it will work. I guess that a deeper look into the API can show where the problem is (Make sure you take a good look at the Util.java class)
There is something you should keep in mind, for the above code to work you need to manually modify the FacebookSDK, here is the full post on that issue: Post message to facebook wall from android fb sdk always error
Upvotes: 1
Reputation: 26
I recently published a blog article on TechRepublic that should help you with this. It is complete with sample code (minus the posting, but if you can't figure it out I'd be glad to help further). You can view my article here:
Upvotes: 0