//然后要进行注册(wxb91199337fe56a69==微信开发平台上的AppId);
api.registerApp(wxb91199337fe56a69);
//进行参数的判断
title=getIntent().getStringExtra(HDCivilizationConstants.SHARE_TITLE); description=getIntent().getStringExtra(HDCivilizationConstants.SHARE_DESRIPTION); shareFilePath=getIntent().getStringExtra(HDCivilizationConstants.SHARE_IMG_PATH); webpageUrl=getIntent().getStringExtra(HDCivilizationConstants.SHARE_TARGET_URL);
sceneFlag=getIntent().getBooleanExtra(HDCivilizationConstants.SHARE_SCENEFLAG, false);
shareType=getIntent().getStringExtra(HDCivilizationConstants.SHARE_TYPE);
(3)然后进行具体参数判断和使用
private void share2Wx(){
// 通过WXAPIFactory工厂,获取IWXAPI的实例
//首先进行检测微信的版本
int wxSdkVersion = api.getWXAppSupportAPI();
if (api.isWXAppSupportAPI() && api.isWXAppInstalled()){
//进行支持:看是否分享到朋友圈还是微信的好友
if(shareType!=null && shareType.equals(HDCivilizationConstants.SHARE_TYPE_WEBURL)){
//网络类型
WXWebpageObject webpage = new WXWebpageObject();
webpage.webpageUrl =this.webpageUrl;
final WXMediaMessage msg = new WXMediaMessage(webpage);
msg.mediaObject=webpage;
//待定
msg.title = title;
msg.description =description ;
if(shareFilePath!=null && !shareFilePath.equals("")){
// if(shareFilePath.startsWith(“http://”)){
// new Thread(){
// @Override
// public void run() {
// try {
// Bitmap bmp=BitmapFactory.decodeStream(new URL(shareFilePath).openStream());
// Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp,99,99, true);
// bmp.recycle();
// msg.thumbData = Util.bmpToByteArray(thumbBmp, true);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }.start();
// }else{
// //本地路径
// System.out.println(“WX FILE PATH:”+shareFilePath);
// Bitmap bmp = BitmapFactory.decodeFile(shareFilePath);
// Bitmap thumbBmp = B