我试图通过Android中的客户端分享一些信息 . 此代码在Gmail,Evernote,Twitter,Viber,Whatsapp等中运行良好,但它在Facebook中不起作用,因为它们不支持EXTRA_TEXT字段(aaargh!) .
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test message");
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(sharingIntent,"Share using"));
所以我想到了一个可能的解决方案 . 当用户单击共享按钮时,我创建了一个新对话框,提供在Facebook和其他人上共享 . 使用Facebook SDK,我可以在Facebook上分享文字,图片等 . 当用户单击“其他”时,正常的共享意图应显示在所有客户端上,但 without the facebook app .
这可能吗?你有其他想法让这项工作?
1 回答
请在StackOverflow上查看此问题 . 这可以帮助您的方案:
How to filter specific apps for ACTION_SEND intent (and set a different text for each app)