2
我有一个应用程序,使用户可以在Facebook上分享图像;我希望自动的应用程序的链接可以与图像共享。在Facebook上分享图像+ AppLink Android
这是我使用的代码,但该链接的部分不理并没有出现:
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/png");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagePath)));
shareIntent.putExtra(Intent.EXTRA_TEXT, "http://www.google.com"); //doesn't appear
PackageManager pm = context.getPackageManager();
List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0);
for (final ResolveInfo app : activityList)
{
Log.d("CitationsManager-ShareOnFb", app.activityInfo.name);
if ((app.activityInfo.name).contains("facebook.katana")
|| (app.activityInfo.name).contains("facebook.composer.shareintent")
|| (app.activityInfo.name).contains("facebook.composer.activity"))
{
final ActivityInfo activity = app.activityInfo;
final ComponentName name = new ComponentName(
activity.applicationInfo.packageName, activity.name);
shareIntent.addCategory(Intent.CATEGORY_LAUNCHER);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
shareIntent.setComponent(name);
context.startActivity(shareIntent);
break;
}
你有什么想法,我怎么能知道检查结果?我已阅读有关该主题的问题,但找不到合适的解决方案。
由于
我也有几乎相似的要求。你有同样的解决方案吗? –