在Facebook墙上发布youtube视频与android SDK中的facebook SDK

时间:2014-10-17 06:31:01

标签: android facebook android-youtube-api

我们可以使用android?

通过Facebook SDK将管视频上传到Facebook帐户墙

请举个例子?

1 个答案:

答案 0 :(得分:0)

private UiLifecycleHelper uiHelper;

if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
                    FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
                String link = "<-GET YOUR YOUTUBE LINK HERE";
                // Publish the post using the Share Dialog
                FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(
                        this)
                        .setName(Id) 
                        .setLink(link)
                        .build();
                uiHelper.trackPendingDialogCall(shareDialog.present());

            }

                public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        uiHelper.onActivityResult(requestCode, resultCode, data,
                new FacebookDialog.Callback() {
                    @Override
                    public void onError(FacebookDialog.PendingCall pendingCall,
                            Exception error, Bundle data) {
                        Log.e("Activity",
                                String.format("Error: %s", error.toString()));
                    }

                    @Override
                    public void onComplete(
                            FacebookDialog.PendingCall pendingCall, Bundle data) {
                        Log.i("Activity", "Success!");
                    }
                });
    }