WXFileObject fileObject = new WXFileObject(); fileObject.setContentLengthLimit(1024 * 1024 * 10); fileObject.setFilePath(filePath + "/" + fileName);//设置文件本地地址 WXMediaMessage msg = new WXMediaMessage(); msg.mediaObject = fileObject; msg.title = fileName; SendMessageToWX.Req req = new SendMessageToWX.Req(); req.transaction = buildTransaction("file"); req.message = msg; req.scene = mTargetScene; LogUtils.i("SendToWXActivity", "mTargetScene---" + buildTransaction("file") + "---" + msg); api.sendReq(req);
http://blog.csdn.net/qq_34706837/article/details/74995536
http://blog.csdn.net/qq_34706837/article/details/74995536
fileObj.setContentLengthLimit(1024 * 1024 * 10);//fileObj.fileData 大小不能超过1M 设置大小的话,必须使用fileObj.filePath 方式String filePath = httpDownloader.downlaodFileReturnFilePath(fileParam,"file",fileName);fileObj.filePath = filePath;
来源:https://www.cnblogs.com/wcLT/p/8574479.html