/**
* 微信分享:分享网页
* @param context
* @param url
* @param title
* @param description
* @param scene
*/
public static void shareToWeChatWithWebpage(Context context, String url,
String title, String description, int scene){
IWXAPI iwxapi = WXAPIFactory.createWXAPI(context, WXEntryActivity.WXAPI_APP_ID);
if (!iwxapi.isWXAppInstalled()){
ToastManager.getInstance(context.getApplicationContext()).showToast("您尚未安装微信客户端");
return;
}
WXWebpageObject wxWebpageObject = new WXWebpageObject();
wxWebpageObject.webpageUrl = url;
WXMediaMessage wxMediaMessage = new WXMediaMessage(wxWebpageObject);
wxMediaMessage.mediaObject = wxWebpageObject;
wxMediaMessage.title = title;
wxMediaMessage.description = description;
wxMediaMessage.thumbData =
ImageManager.bmpToByteArray(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_share_invite), true);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = String.valueOf(System.currentTimeMillis());
req.message = wxMediaMessage;
req.scene = scene;
iwxapi.sendReq(req);
}
public static final int THUMB_LENGTH_LIMIT = 32768; private static final int TITLE_LENGTH_LIMIT = 512; private static final int DESCRIPTION_LENGTH_LIMIT = 1024; private static final int MEDIA_TAG_NAME_LENGTH_LIMIT = 64; private static final int MESSAGE_ACTION_LENGTH_LIMIT = 2048; private static final int MESSAGE_EXT_LENGTH_LIMIT = 2048;
private Bitmap decodeResource(Resources resources, int id) {
TypedValue value = new TypedValue();
resources.openRawResource(id, value);
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inTargetDensity = value.density;
Bitmap bitmap = BitmapFactory.decodeResource(resources, id, opts);
Log.i("Bitmap", "size is " + bitmap.getRowBytes() * bitmap.getHeight());
return bitmap;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有