【问题标题】:Search for linkedin app in android via intent通过intent在android中搜索linkedin应用
【发布时间】:2016-05-20 12:14:14
【问题描述】:

我正在使用意图来获取我可以发布文本的所有应用程序的列表。但是,linkedin 没有出现在该列表中。我需要为linkedin做任何额外的事情吗?

        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_TEXT, "dcsd");
        package= mContext.getPackageManager();
        List<ResolveInfo> appTargets= package.queryIntentActivities(shareIntent, 0);

除了LinkedIn之外,我还能使用Facebook、Twitter等所有其他应用程序吗? 可能的原因是什么?

【问题讨论】:

  • 可能是linkedin没有安装?不要盲目地假设有人安装它。如果它不可用,请优雅地处理它。
  • linkedin 已安装。我没有用上面的代码在linkedin上发帖。只是搜索我可以发布到的应用程序。
  • 另一种可能,是linkedin账号没有设置,所以还不能分享?
  • 它已在我正在测试的设备中正确设置。
  • 它可以在没有 sdk 的 iphone 上运行。你确定我需要 android cz 的 sdk 它会增加应用程序的大小吗?

标签: android android-intent android-sharing


【解决方案1】:

代码是

Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            String shareBody = "https://developers.facebook.com/docs/android/share";
            intent.putExtra(Intent.EXTRA_TITLE,"Share From Test App");
            intent.putExtra(Intent.EXTRA_TEXT,shareBody);
            intent.putExtra(Intent.EXTRA_SUBJECT, "hello");
            startActivity(Intent.createChooser(intent, "Share With"));

【讨论】:

  • 我找到了解决方案。只是添加一个EXTRA_SUBJECT参数。
【解决方案2】:

将此添加到意图中:

intent.putExtra(Intent.EXTRA_SUBJECT, "dsvs");

【讨论】:

    猜你喜欢
    • 2017-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-02
    • 2011-12-14
    • 1970-01-01
    • 2015-11-13
    相关资源
    最近更新 更多