try this, it will work with the authentication dialog
private static final String[] PERMISSIONS = new String[] {"publish_stream", "read_stream", "offline_access"}; Facebook authenticatedFacebook = new Facebook(APP_ID); postButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { authenticatedFacebook.authorize(Tests.this, PERMISSIONS, new TestPostListener()); } }); public class TestPostListener implements DialogListener { public void onComplete(Bundle values) { try { Log.d("Tests", "Testing request for 'me'"); String response = authenticatedFacebook.request("me"); JSONObject obj = Util.parseJson(response); Log.d("Tests", "Testing graph API wall post"); Bundle parameters = new Bundle(); parameters.putString("message", "Amit Siddhpura"); parameters.putString("description", "Hi Mr. Amit Siddhpura"); response = authenticatedFacebook.request("me/feed", parameters, "POST"); Log.d("Tests", "got response: " + response); } catch (Throwable e) { e.printStackTrace(); } } public void onCancel() { } public void onError(DialogError e) { e.printStackTrace(); } public void onFacebookError(FacebookError e) { e.printStackTrace(); } }
user1545066
source share