介绍
小编给大家分享一下安卓怎么实现多图文分享朋友圈功能,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获、下面让我们一起去了解一下吧!
很多安卓程序员都在寻找如何调用系统分享可以实现朋友圈多图加文字分享的功能,小编经过测试入坑后,为你整理以下内容:
private void shareMultiplePictureToTimeLine(文件…,文件),{ Intent 才能;Intent =, new 意图(); ComponentName 才能;comp =, new ComponentName (“com.tencent.mm", ,,,“com.tencent.mm.ui.tools.ShareToTimeLineUI"); intent.setComponent才能(comp); intent.setAction才能(Intent.ACTION_SEND_MULTIPLE); intent.setType才能(“图像/*“); ArrayList<才能;Uri>, imageUris =, new ArrayList(); for 才能;(File f :文件),{ ,,imageUris.add (Uri.fromFile (f)); ,,} intent.putParcelableArrayListExtra才能(Intent.EXTRA_STREAM, imageUris); intent.putExtra才能(“Kdescription",,“wwwwwwwwwwwwwwwwwwww"); startActivity才能(意图); }
localIntent =, new 意图(“android.intent.action.SEND"); localIntent.putExtra才能(“android.intent.extra.TEXT",, paramString1); localIntent.putExtra才能(“sms_body",, paramString1); localIntent.putExtra才能(“Kdescription",, paramString1); if 才能;(localUri1 ==, null) 打破才能; localIntent.putExtra才能(“android.intent.extra.STREAM",, localUri1); localIntent.setType才能(“图像/*“); context.startActivity才能(Intent.createChooser (localIntent,“Share"));
其中最关键的就是:
intent.putExtra (“Kdescription",,文本),
文字部分一直分享失败,搞了很久都分享失败后来才发现是需要加上这一句了·····坑!
原来Kdescription是微信描述信息的键。
原因是:微信的代码已经做了代码混淆,因此看起来有些困难,但是仔细观察还是有很多东西可以看出来的。在此类中我们寻找意图传递的有关关键的名称,找到了好几个,因此我们可以一个个来测试,最终发现就是Kdescription这个键来传递描述信息。
以上是“android怎么实现多图文分享朋友圈功能”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!