我正在使用通用共享意图与手机中安装的其他社交共享应用程序共享包含图像的新闻链接。
一般共享代码为:
twitter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Utils.isNetworkAvailable(NewsDetailed.this)) {
// TODO Auto-generated method stub
Intent sendIntent = new Intent();
Intent i = getIntent();
sendIntent.setAction(Intent.ACTION_SEND);
String Title = i.getStringExtra("title");
String id = i.getStringExtra("id");
sendIntent.putExtra("android.intent.extra.TEXT", "http://www.mywesite.com/?p="+id);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
else{
showToast("Can't Post in Offline mode");
}
}
});
此代码适用于 google plus、twitter、pintrest、umano 等。
如果我想与 Facebook 分享我的新闻,它也适用于附有图片的新闻。
但是,如果新闻中没有附加图像,它会从共享的 Web 链接中选择没有任何标准的图像,而不是选择默认图像。但是,如果与其他社交共享应用程序共享相同的链接,它可以正常工作并选择默认图像。
如果有人对如何解决此 Facebook 问题有任何想法,请告诉我。我的应用程序发布在 google play 商店https://play.google.com/store/apps/details?id=com.Almuqeet.risingkashmir上。