文件分享后,界面显示为0B,重要代码如下:
/**
* 分享文件
*/
private void shareFile(ShareContent shareContent, int shareType) {
WXFileObject fileObj = new WXFileObject();
fileObj.setFilePath(shareContent.getFilePath());
fileObj.setContentLengthLimit(1024*1024*10);
Log.i("tobyy","==============bbbbb==="+shareContent.getFilePath());
// fileObj.fileData = Util.inputStreamToByte(shareContent.getFilePath());//文件路径
// fileObj.filePath =shareContent.getFilePath();
WXMediaMessage msg = new WXMediaMessage(fileObj);
msg.mediaObject=fileObj;
msg.title = "title";
msg.description="描述";
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("file");
req.message = msg;
req.scene = shareType;
mWXApi.sendReq(req);
}
不清楚呢