Android Studio:使用Facebook SDK将文件共享到Messenger

时间:2015-08-10 16:32:20

标签: android facebook messenger

如何使用Facebook SDK与Messenger共享文件。

出于某种原因,当我进入Share to Messenger对话框窗口时,它会停留几秒钟并关闭。那是为什么?

 String sayWhat = "This is what you sound like when you write to me, thanks to the app Messenger Say it! Available now at Google Play";
    HashMap hashmap = new HashMap();
    hashmap.put("utteranceId", sayWhat);
    String location = (new StringBuilder(this.getFilesDir().toString())).append(name).append(".wav").toString();
    Uri uri = Uri.parse(location);
 ttsread.synthesizeToFile(sayWhat, hashmap, location);
    ShareLinkContent.Builder shareLinkContentBuilder = new ShareLinkContent.Builder().
            setContentDescription("Share with friends").setContentTitle("Messenger SAY IT").setContentUrl(uri);
    callbackManager = CallbackManager.Factory.create();

    MessageDialog messageDialog = new MessageDialog(this);
    messageDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
        @Override
        public void onSuccess(Sharer.Result result) {


        }

        @Override
        public void onCancel() {

        }

        @Override
        public void onError(FacebookException e) {

        }
    });
    messageDialog.show(shareLinkContentBuilder.build());

提前致谢!

1 个答案:

答案 0 :(得分:0)

这是因为Facebook Messenger没有安装在设备上。 调用Web功能似乎无法在Android 6.0 api 23中运行。