Android 和 Facebook 共享意图 [英] Android and Facebook share intent

查看:32
本文介绍了Android 和 Facebook 共享意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Android 应用,我很想知道如何使用 Android 的共享意图从应用内更新应用用户的状态.

I'm developing an Android app and am interested to know how you can update the app user's status from within the app using Android's share intents.

查看了 Facebook 的 SDK 后,这似乎很容易做到,但是我很想让用户通过常规的 Share Intent 弹出窗口来完成?在这里看到:

Having looked through Facebook's SDK it appears that this is easy enough to do, however I'm keen to allow the user to do it via the regular Share Intent pop up window? seen here:

我已经尝试了通常的分享意图代码,但是这似乎不再适用于 Facebook.

I have tried the usual share intent code, however this no longer appears to work for Facebook.

public void invokeShare(Activity activity, String quote, String credit) {
    Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, activity.getString(R.string.share_subject));
    shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Example text");    

    activity.startActivity(Intent.createChooser(shareIntent, activity.getString(R.string.share_title)));
}

更新:经过更多的挖掘,看起来好像这是 Facebook 应用程序的一个尚未解决的错误!(facebook bug)同时看起来我只是将不得不忍受负面的分享不起作用!!!"评论.干杯脸书:*(

UPDATE: Having done more digging, it looks as though it's a bug with Facebook's app that has yet to be resolved! (facebook bug) For the mean time it looks like I'm just going to have to put up with the negative "Sharing doesn't work!!!" reviews. Cheers Facebook :*(

推荐答案

Facebook 应用程序不处理 EXTRA_SUBJECTEXTRA_TEXT 字段.

这里是错误链接:https://developers.facebook.com/bugs/332619626816423

感谢@billynomates:

Thanks @billynomates:

问题是,如果你在 EXTRA_TEXT 字段中输入一个 URL,它确实工作.就像他们故意剥离任何文本一样.

The thing is, if you put a URL in the EXTRA_TEXT field, it does work. It's like they're intentionally stripping out any text.

这篇关于Android 和 Facebook 共享意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆