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

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

问题描述

我开发一个Android应用程序,并有兴趣知道如何可以从应用程序中使用Android的份额意图更新应用程序用户的状态。

通过Facebook的SDK已经观察看来,这是很容易的事,但是我渴望允许用户通过定期共享意向做弹出窗口?在这里看到:

我已经尝试了平时份额的意图code,然而,这似乎不再工作,为Facebook。

 公共无效invokeShare(活动活动,字符串引号,字符串信贷){
    意图shareIntent =新的意图(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,示例文本);

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

更新: 有做多的挖掘,它看起来就好像它是一个尚未解决的与Facebook的应用程序中的错误! ( Facebook的错误)对于平均时间,它看起来像我只是将不得不把与否定共享不起作用!评论。干杯的Facebook:*(

解决方案
  

在Facebook的应用程序不处理任何的 EXTRA_SUBJECT EXTRA_TEXT 字段。

下面是错误的链接:<一href="https://developers.facebook.com/bugs/332619626816423">https://developers.facebook.com/bugs/332619626816423

感谢@billynomates:

  

的事情是,如果你把在 EXTRA_TEXT 字段的URL,它的确实的   工作。这就像他们有意剥离出任何文本。

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.

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:

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)));
}

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 :*(

解决方案

The Facebook application does not handle either the EXTRA_SUBJECT or EXTRA_TEXT fields.

Here is bug link: https://developers.facebook.com/bugs/332619626816423

Thanks @billynomates:

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天全站免登陆