http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.google.com
如何自定义文本和图像.看起来Facebook拉动了文档.
有没有类似于getsharekit.com的Android?它允许共享URL到社交网站.有没有类似的东西,或者我需要单独为Facebook,Twitter和电子邮件编码?
我正在尝试使用Android分享意图在Facebook上发布内容.它看起来像这样:
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Free education for all! http://linkd.in/xU8mCc");
startActivity(shareIntent);
Run Code Online (Sandbox Code Playgroud)
所以我的帖子有两个 - 一些文字和一个链接.但是当消息在Facebook上发布时,它只有链接,没有消息.我尝试了各种附加功能,但没有任何作用
有人遇到过这个问题并解决了吗?我有Facebook应用程序版本1.8.1
编辑:我尝试删除链接,Facebook应用程序不接收我的消息(显示一个空白消息要发布),但不是相反的方式.所以看起来应用程序完全忽略了任何纯文本消息.我吓坏了!这是fb应用程序中的一个主要错误,根本无法发布文本消息(具有共享意图)?
由于Facebook不允许通过Intent共享文本,除非我们使用Facebook sdk,我正在寻找实现这一目标的方法.
我可以想到我可以使用的3个黑客:
1)由于Facebook允许图像共享,我可以生成一个Bitmap共享文本,并使用它共享图像Intent.
2)Facebook允许共享URL,在分享时它也会显示Head页面.我可以在我的服务器上托管一个专用页面,并将值作为参数传递给url,并生成Head使用它.(我没有使用php的经验,但我想这是可能的)
3)将文本复制到剪贴板并通知用户.
要么
使用所有3的组合.
任何人都可以建议我更好的方式在Facebook上分享我的内容,而不使用Facebook sdk?
提前致谢.
我在我的应用程序中有一个共享按钮,我想同时共享图像和文本.Gmail中工作正常,但在WhatsApp的,只有图像被发送和Facebook的应用程序崩溃.
我使用共享代码是这样的:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Message");
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/drawable/ford_focus_2014");
try {
InputStream stream = getContentResolver().openInputStream(uri);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
Run Code Online (Sandbox Code Playgroud)
如果我使用"shareIntent.setType("*/*")"Facebook和WhatsApp崩溃.
有办法做到这一点吗?也许同时发送两条消息(WhatsApp).
提前致谢.
我想在Facebook上分享我的游戏分数.我查了很多环节,每一个岗位的人说,POSTING上使用Facebook的意向是不可能的.如果我们使用的意图不是我们可以共享的唯一联系.
如果我们必须在Facebook上分享一些东西,那么我们必须使用FaceBook SDK.
我怀疑所有的问题和答案是在2014年之前发布的.2014年之后是否有新事物发生.
我的实际问题是,是否有可能使用Intent在Facebook上分享分数,或者我必须使用Facebook SDK?
下面是我用于我的应用程序的意图代码,它不起作用......
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, message);
startActivity(Intent.createChooser(intent, "Share on"));
Run Code Online (Sandbox Code Playgroud)
以下是FacebookSDK代码...并且问题在于它没有显示仅发布链接图像上的分数,并且缺少标题和描述.
FacebookSdk.sdkInitialize(getApplicationContext());
shareDialog = new ShareDialog(this);
if (ShareDialog.canShow(ShareLinkContent.class)) {
linkContent = new ShareLinkContent.Builder()
.setContentTitle(title)
.setContentDescription(description)
.setContentUrl(Uri.parse(link)).
.setImageUrl(Uri.parse(imageLink)
.build();
shareDialog.show(linkContent);
}
Run Code Online (Sandbox Code Playgroud)
我使用ShareDialog是因为
"共享"对话框切换到原生Facebook for Android应用程序,然后在发布帖子后将控制权返回给您的应用程序.如果未安装Facebook应用程序,它将自动回退到基于Web的对话框.
以下是输出..........
@pravin这是您使用共享API后出现的错误
@Pravin这是我的代码答案........ …
我一直在努力将文本从我的应用程序发送到Twitter.
下面的代码用于显示蓝牙,Gmail,Facebook和Twitter等应用程序列表,但是当我选择Twitter时,它不会像我预期的那样预填充文本.
我知道围绕Facebook做这个问题有一些问题,但我必须做错事才能与Twitter合作.
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "Example Text");
startActivity(Intent.createChooser(intent, "Share Text"));
Run Code Online (Sandbox Code Playgroud) 我想通过Facebook从android jelly bean分享一些图片和文字.除了android jelly bean之外,它适用于所有设备.有人请帮我解决这个问题.
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Content to share");
PackageManager pm = v.getContext().getPackageManager();
List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0);
for (final ResolveInfo app : activityList) {
if ((app.activityInfo.name).contains("facebook")) {
final ActivityInfo activity = app.activityInfo;
final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name);
System.out.println("package name"+name);
shareIntent.addCategory(Intent.CATEGORY_LAUNCHER);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
shareIntent.setComponent(name);
v.getContext().startActivity(shareIntent);
break;
Run Code Online (Sandbox Code Playgroud)
在这段代码中,我想要一些文字.但EXTRA_TEXT无效.如何在此EXTRA_TEXT中传递字符串或图像.
如何使用Action_view意图在Android的Facebook墙上发布?
我已经完成了facebook sdk与我的Android应用程序的集成,它对我来说很好.
但我想用Action_view意图去做.
现在我想与下面的链接共享文本是我的代码
String myText = "Hey!\nThis is a my Text!";
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
String extraText = "www.mylink.com\n\n" + myText ;
share.putExtra(Intent.EXTRA_TEXT, extraText);
startActivity(Intent.createChooser(share, "Share with Friends"));
Run Code Online (Sandbox Code Playgroud)
所以它与gmail,twitter等工作正常,但它不适用于Facebook
在Facebook上它只分享链接但没有显示我的文字
我想要这种类型的分享
www.mylink.com
here is my text
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激,在此先感谢.
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/html");
String str = et.getText().toString();
i.putExtra(android.content.Intent.EXTRA_TEXT,str);
startActivity(Intent.createChooser(i,"Share using"));
Run Code Online (Sandbox Code Playgroud)
我无法在Android中使用此代码打开Facebook和Twitter,但其他应用程序(如Gmail和Skype)已成功打开.为什么?我如何打开Facebook和Twitter?
当用户打开它时,我需要在我的应用程序中共享特定部分,如果他下载我的应用程序,它直接导航到此部分(它可能是嵌套片段).
String AppURL = "https://play.google.com/store/apps/details?id=" + getApplicationContext().getPackageName();
String urlToShare = "http://stackoverflow.com/questions/7545254"; // I need custom url to specific part in my app
// See if official Facebook app is found
boolean facebookAppFound = false;
List<ResolveInfo> matches = getPackageManager().queryIntentActivities(intent, 0);
for (ResolveInfo info : matches) {
if (info.activityInfo.packageName.toLowerCase().startsWith("com.facebook.katana")) {
intent.setPackage(info.activityInfo.packageName);
facebookAppFound = true;
break;
}
}
// As fallback, launch sharer.php in a browser
if (!facebookAppFound) {
String sharerUrl = "https://www.facebook.com/sharer/sharer.php?u=" + urlToShare;
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sharerUrl));
}else{
Intent intent …Run Code Online (Sandbox Code Playgroud) I have the following code which used to send text from my app to Email:
Intent mail = new Intent(Intent.ACTION_VIEW);
mail.setClassName("com.google.android.gm","com.google.android.gm.ComposeActivityGmail");
mail.putExtra(Intent.EXTRA_EMAIL, new String[] { });
mail.setData(Uri.parse(""));
mail.putExtra(Intent.EXTRA_SUBJECT, "Country Decryption");
mail.setType("plain/text");
mail.putExtra(Intent.EXTRA_TEXT, "my text");
ctx.startActivity(mail);
Run Code Online (Sandbox Code Playgroud)
It works , but as you see, it uses Gmail app, how do I make it use Email application instead of Gmail?
and what about sharing to Facebook ? I found that Facebook does not support sharing using intent anymore, and …