Post on Facebook wall using Facebook Android SDK without opening dialog box

前端 未结 5 1738
抹茶落季
抹茶落季 2020-11-29 19:56

Using the Facebook SDK, I can login and store my access_token into a database. When I try to create a post, the Facebook wall is still empty on both my phone an

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 20:22

    i applied following code and could successfully posted my message on wall.

    public void postOnWall(String msg) {
            Log.d("Tests", "Testing graph API wall post");
             try {
                    String response = mFacebook.request("me");
                    Bundle parameters = new Bundle();
                    parameters.putString("message", msg);
                    parameters.putString("description", "test test test");
                    response = mFacebook.request("me/feed", parameters, 
                            "POST");
                    Log.d("Tests", "got response: " + response);
                    if (response == null || response.equals("") || 
                            response.equals("false")) {
                       Log.v("Error", "Blank response");
                    }
             } catch(Exception e) {
                 e.printStackTrace();
             }
        }
    

提交回复
热议问题