Cartesian Theater
Cartesian Theater

Reputation: 1970

Android Facebook SDK 3.0 Tutorial: "The post's links must direct to the application's connect or canvas URL"

I'm new to the Android Facebook SDK 3.0. I'm trying to follow this tutorial at https://developers.facebook.com/docs/howtos/androidsdk/3.0/feed-dialog/ about using a Feed Dialog. I successfully got the login tutorial to work, but with this tutorial I keep getting the error in the title of this question. I copied this method into my MainFragment class:

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

WebDialog feedDialog = (
    new WebDialog.FeedDialogBuilder(getActivity(),
        Session.getActiveSession(),
        params))
    .setOnCompleteListener(new OnCompleteListener() {

        @Override
        public void onComplete(Bundle values,
            FacebookException error) {
            if (error == null) {
                // When the story is posted, echo the success
                // and the post Id.
                final String postId = values.getString("post_id");
                if (postId != null) {
                    Toast.makeText(getActivity(),
                        "Posted story, id: "+postId,
                        Toast.LENGTH_SHORT).show();
                } else {
                    // User clicked the Cancel button
                    Toast.makeText(getActivity().getApplicationContext(), 
                        "Publish cancelled", 
                        Toast.LENGTH_SHORT).show();
                }
            } else if (error instanceof FacebookOperationCanceledException) {
                // User clicked the "x" button
                Toast.makeText(getActivity().getApplicationContext(), 
                    "Publish cancelled", 
                    Toast.LENGTH_SHORT).show();
            } else {
                // Generic, ex: network error
                Toast.makeText(getActivity().getApplicationContext(), 
                    "Error posting story", 
                    Toast.LENGTH_SHORT).show();
            }
        }

    })
    .build();
feedDialog.show(); }

I can't seem to find anything on this problem for those using Android Facebook SDK 3.0.

Upvotes: 0

Views: 1958

Answers (1)

Ming Li
Ming Li

Reputation: 15662

Go to your app settings, click on Advanced, and make sure the "Stream post URL security" setting is "Disabled".

Upvotes: 2

Related Questions