开发者

Post text to Facebook Wall

Im develop a app to post a simple text to facebook.here is the code I'm using..

Bundle parameters = new Bundle();
parameters.putString("message", msgWil开发者_开发百科lPost);
response = mFacebook.request("me/feed", parameters, "POST");

it work... but the problem I'm facing now is when the "msgWillPost" length too longer, then it will return error. here is the error:

{"error":{"type":"OAuthException","message":"(#1) An unknown error occurred"}}

which I get return from response. May I konw isn't Facebook request have any limit character to post? or it was other issue. Thank you.

P/S: sorry about my english hope u guys understand what I'm talking about. Thanks.

Regards,

WynixToo


btnLogin.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            facebook.authorize(FbdemoActivity.this, new String[]{ "user_photos,publish_checkins,publish_actions,publish_stream"},new DialogListener() {
                @Override
                public void onComplete(Bundle values) {



                }

                @Override
                public void onFacebookError(FacebookError error) {
                }

                @Override
                public void onError(DialogError e) {
                }

                @Override
                public void onCancel() {
                }
            });

        }
    });
public void postOnWall(String msg) {
        Log.d("Tests", "Testing graph API wall post");
         try {
                String response = facebook.request("me");
                Bundle parameters = new Bundle();
                parameters.putString("message", msg);
                parameters.putString("description", "test test test");
                response = facebook.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();
         }

add permission in authorize method


I know status updates must be less than 420 characters. Have you tried 419 characters to make sure that post succeeds?

If this is really the issue (which is weird that the error message isn't very helpful), then you'll probably want to do input validation in your app prior to posting to Facebook.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜