0

I want to be able to share posts from my android app but i couldn't achieve it. I have added the facebook sdk 3.0 to my application. I could get a userName, userFirstName, userLastName and etc. But i cannot send feeds. Below is the code that I use:

Bundle postParams = new Bundle();
postParams.putString("name", "Facebook SDK for Android");
postParams.putString("caption", "Build great social apps and get more installs.");
postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
postParams.putString("link", "https://developers.facebook.com/android");
postParams.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");

Request.Callback callback= new Request.Callback() {
    public void onCompleted(Response response) {
                        Log.e("Sonuc", "Geldi");
    }
};

Request request = new Request(session, "me/feed", postParams, HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();

this snippet is from https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/

When I execute this code it Logs as it is finished successfully. I mean onComplete method of the Request.Callback works properly.. Nothing else is logged as error. I can not understand why it does not work? Is it something to do with the publish permissions?

What is the problem with this snippet?

gurkan
  • 3,457
  • 4
  • 25
  • 38

1 Answers1

0

Maybe you forget to get permission of "publish_actions" ?

private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
for (String string : subset) {
    if (!superset.contains(string)) {
        return false;
    }
}
return true;
}

if (!isSubsetOf(PERMISSIONS, permissions)) {
        pendingPublishReauthorization = true;
        Session.NewPermissionsRequest newPermissionsRequest = new Session
                .NewPermissionsRequest(this, PERMISSIONS);
    session.requestNewPublishPermissions(newPermissionsRequest);
        return;
    }
demongolem
  • 9,474
  • 36
  • 90
  • 105
AlanChien
  • 37
  • 5