温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

android怎么实现多图文分享朋友圈功能

发布时间:2021-04-16 13:01:12 来源:亿速云 阅读:252 作者:小新 栏目:移动开发

小编给大家分享一下android怎么实现多图文分享朋友圈功能,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

很多安卓程序员都在寻找如何调用系统分享可以实现朋友圈多图加文字分享的功能,小编经过测试入坑后,为你整理以下内容:

private void shareMultiplePictureToTimeLine(File... files) {
  Intent intent = new Intent();
  ComponentName comp = new ComponentName("com.tencent.mm",
    "com.tencent.mm.ui.tools.ShareToTimeLineUI");
  intent.setComponent(comp);
  intent.setAction(Intent.ACTION_SEND_MULTIPLE);
  intent.setType("image/*");

  ArrayList<Uri> imageUris = new ArrayList<Uri>();
  for (File f : files) {
   imageUris.add(Uri.fromFile(f));
  }
  intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
  intent.putExtra("Kdescription", "wwwwwwwwwwwwwwwwwwww");
  startActivity(intent);
}
localIntent = new Intent("android.intent.action.SEND");
  localIntent.putExtra("android.intent.extra.TEXT", paramString1);
  localIntent.putExtra("sms_body", paramString1);
  localIntent.putExtra("Kdescription", paramString1);
  if (localUri1 == null)
  break;
  localIntent.putExtra("android.intent.extra.STREAM", localUri1);
  localIntent.setType("image/*");
  context.startActivity(Intent.createChooser(localIntent, "Share"));

其中最关键的就是:

intent.putExtra("Kdescription", text);

文字部分一直分享失败,搞了很久都分享失败后来才发现是需要加上这一句了·····坑!
原来Kdescription是微信描述信息的键。

原因是:微信的代码已经做了代码混淆,因此看起来有些困难,但是仔细观察还是有很多东西可以看出来的。在此类中我们寻找Intent传递的有关key的名称,找到了好几个,因此我们可以一个个来测试,最终发现就是Kdescription这个键来传递描述信息。

android怎么实现多图文分享朋友圈功能

以上是“android怎么实现多图文分享朋友圈功能”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI