makaron
makaron

Reputation: 77

Android Facebook Story post return message: Invalid parameter

I use facebook sample for story posting:

public static void postStory(Activity activity) {
    String fbAppId = activity.getString(R.string.facebook_app_id);
    ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
            .putString("fb:app_id", fbAppId)
            .putString("og:type", "books.book")
            .putString("og:title", "A Game of Thrones")
            .putString("og:description", "In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.")
            .putString("books:isbn", "0-553-57340-3")
            .build();

    ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
            .setActionType("books.reads")
            .putObject("book", object)
            .build();

    ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
            .setPreviewPropertyName("book")
            .setAction(action)
            .build();

    boolean canShare = new ShareApi(content).canShare();
    ShareDialog.show(activity, content);
    ShareApi.share(content, new FacebookCallback<Sharer.Result>() {
        @Override
        public void onSuccess(Sharer.Result result) {
            Log.d(TAG, result.toString());
        }

        @Override
        public void onCancel() { }

        @Override
        public void onError(FacebookException e) {
            Log.d(TAG, e.toString());
        }
    });
}

canShare() return true, ShareDialog work very well, but ShareApi return:

{FacebookGraphResponseException: Invalid parameter httpResponseCode: 500, facebookErrorCode: 100, facebookErrorType: FacebookApiException, message: Invalid parameter}

What could be the problem?

Upvotes: 0

Views: 269

Answers (1)

ifaour
ifaour

Reputation: 38135

What SDK version are you using? we had a bug similar to your case that was resolved in v4.1.2+:

Sharing Open Graph objects via the ShareApi could fail to properly stage nested objects.

Upvotes: 1

Related Questions