开发者

how to to disable facebook feed dialog

开发者 https://www.devze.com 2023-03-17 18:57 出处:网络
I had used a faceboo开发者_如何学Pythonk app to post message on wall from https://github.com/facebook/facebook-android-sdk.

I had used a faceboo开发者_如何学Pythonk app to post message on wall from https://github.com/facebook/facebook-android-sdk.

Here after user allows the app to use his/her profile, dialog feed comes with an editable area to publish or skip. I want a predefined message there but user will not be able to modify it. I am able to send the predifined message but its editable. How to make it uneditable.

Does any one knows how to do it??


You can just use a function to post directly to the users wall. Just make sure that it is clear to the user that the button posts directly, perhaps use a dialog to get them to confirm they want to post. Here is the code I use:

/**
 * Post to a friends wall
 * @param msg Message to post
 * @param userId Id for friend to post to or null to post to users wall
 */
public void postToWall(String msg, String userID) {
    Log.d("Tests", "Testing graph API wall post");
    try {
        if (isSession()) {
            String response = mFacebook.request((userID == null) ? "me" : userID);
            Bundle parameters = new Bundle();
            parameters.putString("message", msg);
            response = mFacebook.request(((userID == null) ? "me" : userID) + "/feed", parameters, "POST");
            Log.d(TAG,response);
            if (response == null || response.equals("") || 
                    response.equals("false")) {
                Log.v("Error", "Blank response");
            }

        } else {
            // no logged in, so relogin
            Log.d(TAG, "sessionNOTValid, relogin");
            mFacebook.authorize(this, PERMS, new LoginDialogListener());
        }
    } catch(Exception e) {
        e.printStackTrace();
    }
}


The dialog contains a WebView that loads the actual content from a Facebook URL. So to modify the editable area, you would need to modify the DOM of this webpage. See this question for more information about doing that. It is unclear to me from the answers in that question if this is possible. If it is, you'll need to add the code to the FbDialog class in the Facebook Android SDK.

0

精彩评论

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