android 不调用微信,易信等SDK实现实现一键分享图片文字到微信,易信,以及全部可选app
2014-04-24 09:27
876 查看
最近因为回过头来学习intent,所以研究了一下这一块知识。因为以前用ShareSDK实现过对新浪,以及微信好友,以及朋友圈等的分享,但是,众所周知这些平台的审核机制甚是麻烦,所以若是社交分享功能对开发者的app而言,不过是鸡肋的话,那么便可用此方法来实现分享,省心省力。想到此处,我觉得此方法亦是比较实用,故放出来与大家共享,也权当笔记,留待以后查看:
有图有真相:
![](http://a1.eoe.cn/www/home/201404/23/cd08/5357c1872aca6.png)
![](http://a1.eoe.cn/www/home/201404/23/8566/5357c1f46dab0.png)
废话不说,直接上源码:
1.实现对微信好友圈的分享:
private void shareToWechatFriends() {
String imgPath = "/sdcard/share_pic.jpg";
Intent intent = new Intent(Intent.ACTION_SEND);
File file = new File(imgPath);
if (file != null && file.exists() && file.isFile()) {
intent.setType("image/*");
Uri u = Uri.fromFile(file);
intent.putExtra(Intent.EXTRA_STREAM, u);
}
ComponentName comp = new ComponentName("com.tencent.mm",
"com.tencent.mm.ui.tools.ShareToTimeLineUI");
intent.setComponent(comp);
intent.setAction("android.intent.action.SEND");
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_TEXT, "固定字段");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(intent);
}
2.实现对微信好友的分享:
public void shareToWechat() {
String imgPath = "/sdcard/share_pic.jpg";
Intent intent = new Intent(Intent.ACTION_SEND);
File file = new File(imgPath);
if (file != null && file.exists() && file.isFile()) {
intent.setType("image/*");
Uri u = Uri.fromFile(file);
intent.putExtra(Intent.EXTRA_STREAM, u);
}
ComponentName comp = new ComponentName("com.tencent.mm",
"com.tencent.mm.ui.tools.ShareImgUI");
intent.setComponent(comp);
intent.setAction("android.intent.action.SEND");
intent.setType("image/*");
// intent.setFlags(0x3000001);
intent.putExtra(Intent.EXTRA_TEXT, "固定字段");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(intent);
有图有真相:
![](http://a1.eoe.cn/www/home/201404/23/cd08/5357c1872aca6.png)
![](http://a1.eoe.cn/www/home/201404/23/8566/5357c1f46dab0.png)
废话不说,直接上源码:
1.实现对微信好友圈的分享:
private void shareToWechatFriends() {
String imgPath = "/sdcard/share_pic.jpg";
Intent intent = new Intent(Intent.ACTION_SEND);
File file = new File(imgPath);
if (file != null && file.exists() && file.isFile()) {
intent.setType("image/*");
Uri u = Uri.fromFile(file);
intent.putExtra(Intent.EXTRA_STREAM, u);
}
ComponentName comp = new ComponentName("com.tencent.mm",
"com.tencent.mm.ui.tools.ShareToTimeLineUI");
intent.setComponent(comp);
intent.setAction("android.intent.action.SEND");
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_TEXT, "固定字段");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(intent);
}
2.实现对微信好友的分享:
public void shareToWechat() {
String imgPath = "/sdcard/share_pic.jpg";
Intent intent = new Intent(Intent.ACTION_SEND);
File file = new File(imgPath);
if (file != null && file.exists() && file.isFile()) {
intent.setType("image/*");
Uri u = Uri.fromFile(file);
intent.putExtra(Intent.EXTRA_STREAM, u);
}
ComponentName comp = new ComponentName("com.tencent.mm",
"com.tencent.mm.ui.tools.ShareImgUI");
intent.setComponent(comp);
intent.setAction("android.intent.action.SEND");
intent.setType("image/*");
// intent.setFlags(0x3000001);
intent.putExtra(Intent.EXTRA_TEXT, "固定字段");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(intent);
1 2 | 再次声明,若是社交分享需要统计数据等操作,那么请绕道去shareSDK或者友盟进行集成!!! 源码下载地址:http://download.csdn.net/detail/u010835702/7242053 |
相关文章推荐
- Android 调用系统的分享[完美实现同时分享图片和文字]
- Android应用实现微信分享(微信好友,朋友圈),分享链接,图片,文字
- Android使用Intent一键分享图片文字到腾讯、新浪、开心、微信等
- Android 分享app到QQ好友、微信好友、朋友圈(无需提供SDK,只需调用相关的Activity)
- android调用系统分享实现朋友圈同时分享文字和图片(可多张)
- Android使用Intent一键分享图片文字到腾讯、新浪、开心、微信等
- Android APP 分享图片文字到微信刚开始正常,后面就不弹出分享框了
- Android使用Intent一键分享图片文字到腾讯、新浪、开心、微信等
- 将企业协作与微信结合,明道打通微信实现从微信到明道的消息分享,目前已支持文字、图片以及链接
- [置顶] 安卓调用系统自带分享功能分享文字,分享大图片,仿好奇心日报分享长图片(不用申请微信微博官方sdk就能直接分享)
- Android APP 分享图片文字到微信刚開始正常,后面就不弹出分享框了
- 不接sdk实现分享图片文字到微博、微信、微信朋友圈、QQ好友、QQ空间!!!
- Android 调用系统的分享[完美实现同一时候分享图片和文字]
- Android实现分享图片和文字的功能
- Android -- 查询手机上所有的能分享图片或者文字的App packageName
- android使用友盟实现第三方登录、分享以及微信回调无反应问题解决办法
- Android使用Intent一键分享图片文字到腾讯、新浪、开心、人人等
- Android实现新浪微博SSO授权登录分享文字图片等功能(WEIBO_ANDROID_SDK V2.3.0 )
- 微信分享图片 文字 Android原生分享图片文字 微信小程序分享
- Android端App调用微信分享的具体流程记录