简体   繁体   中英

Android Facebook SDK 3 posting to friends feed doesnt work

Can someone send REALLY working NOW simple?

I'm use next:

1) Make authorization in app

2) then on button pressed publishFeedDialog();

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 And0roid makes it easier and faster to develop Facebook integrated Android apps.");
  params.putString("link", "https://developers.facebook.com/android");
 params.putString("picture", "");

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

            @Override
            public void onComplete(Bundle values,
                FacebookException error) {

                Log.e("TAG",values.toString());

                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(activity,
                            "Posted story, id: "+postId,
                            Toast.LENGTH_SHORT).show();
                    } else {
                        // User clicked the Cancel button
                        Toast.makeText(activity.getApplicationContext(), 
                            "Publish cancelled", 
                            Toast.LENGTH_SHORT).show();
                    }
                } else if (error instanceof FacebookOperationCanceledException) {
                    // User clicked the "x" button
                    Toast.makeText(activity.getApplicationContext(), 
                        "Publish cancelled", 
                        Toast.LENGTH_SHORT).show();
                } else {
                    // Generic, ex: network error
                    Toast.makeText(activity.getApplicationContext(), 
                        "Error posting story", 
                        Toast.LENGTH_SHORT).show();
                }
            }



        })
        .setFrom("")
       .setTo(userId)
        .build();
         feedDialog.show();
}

While I send messsage I see that my friend currectly recognized from Id.

I receive something like:

Webview loading URL: https://m.facebook.com/dialog/feed
Redirect URL: fbconnect://success?post_id=1266196038_167455066740536

But message in frends feed doesnt appear. Code without .setTo(userId) send me at feed my message as normal.

In authorization I use

List<String> permission = new ArrayList<String>();

        permission.add("publish_actions");
        permission.add("publish_stream");

and write app_id in manifest.

<meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/app_id" />

Help me please!

PS Does send to friend's feed at facebook working now (after feb 2013) ?

(Edit): This is only applicable via the graph API.

Look here at the second last point under February 2013 Breaking Changes Now Live. Its no longer available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM