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 RecyclerView 复用错乱通用解法详解
本篇文章主要介绍了Android RecyclerView 复用错乱通用解法详解,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2017-08-08Android编程中TextView字体属性设置方法(大小、字体、下划线、背景色)
这篇文章主要介绍了Android编程中TextView字体属性设置方法,包括大小、字体、下划线、背景色等设置技巧,具有一定参考借鉴价值,需要的朋友可以参考下2015-10-10Android自定义收音机搜台控件RadioRulerView
这篇文章主要为大家详细介绍了Android自定义收音机搜台控件RadioRulerView的相关代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2017-04-04Android中findViewById获取控件返回为空问题怎么解决
这篇文章主要介绍了Android中findViewById获取控件返回为空问题怎么解决的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下2016-06-06如何通过Android Logcat插件分析firebase崩溃问题
android crash Crash(应用崩溃)是由于代码异常而导致App非正常退出,导致应用程序无法继续使用,所有工作都停止的现象,本文重点介绍如何通过Android Logcat插件分析firebase崩溃问题,感兴趣的朋友一起看看吧2024-01-01
最新评论