Android 共享按钮don';t使用facebook运行(文本为空)
与Viber和What's应用程序共享按钮运行 但不要使用Facebook, 只是空白区Android 共享按钮don';t使用facebook运行(文本为空),android,android-studio,android-intent,share,Android,Android Studio,Android Intent,Share,与Viber和What's应用程序共享按钮运行 但不要使用Facebook, 只是空白区 Intent myIntent = new Intent(Intent.ACTION_SEND); bt = findViewById(R.id.imageShareButton); bt.setOnClickListener(new View.OnClickListener() { public void onClick(View v) {
Intent myIntent = new Intent(Intent.ACTION_SEND);
bt = findViewById(R.id.imageShareButton);
bt.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String shareBody = versesText.getText().toString();
myIntent.setType("text/plain");
myIntent.putExtra(Intent.EXTRA_SUBJECT, "Perfect Verses");
myIntent.putExtra(Intent.EXTRA_TEXT, shareBody + "\n" + "Read More...");
myIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(myIntent, getResources().getString(R.string.app_name)));
}
});
我的应用程序在Google Play上的链接,
我运行了你的代码,得到了这个,我想你忘记添加操作了
val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "subject")
sharingIntent.putExtra(Intent.EXTRA_STREAM, titl + "\n" + "Read More..." + "\n" + link)
startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.app_name)))
事实上,我之前添加了发送操作,但它不适用于Facebook。我用你发送的一些代码更新了有问题的代码,但它在Facebook上也不起作用。它只适用于Gmail和Viber。@samuel我试过你的代码,效果很好,我用图像更新了它。你在测试哪款设备?三星Note 5和HTC Desire 728 Ultra。它与Facebook合作吗??或者是在我发布给你的应用程序“what's in your mind”(你的想法是什么)中添加一条文字,如果你想测试我的应用程序,你是否已经尝试过问题上发布的解决方案?这个问题将通过设计来解决,因为我们的API不支持像我们的政策文档中所示的那样为用户预填充消息。我认为这是不可能的。。这是悲哀的:(你将需要使用Facebook的SDK来允许在他们的应用程序上共享。你可以阅读官方文档,可能是我尝试了这个链接的副本,但它只适用于url,不适用于文本。我想这是Facebook验证。
String packageName = "com.facebook.katana";
String fullUrl = "https://m.facebook.com/sharer.php?u=..";
Intent intent = getPackageManager().getLaunchIntentForPackage(packageName);
if (intent == null) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(fullUrl));
startActivity(i);
} else {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setClassName(packageName ,
"com.facebook.katana.ShareLinkActivity");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "your title text");
startActivity(sharingIntent);