public static void shareFileToWeiXin(Context context, String path) {
IWXAPI api = WXAPIFactory.createWXAPI(context, WX_APP_ID);
WXFileObject fileObj = new WXFileObject();
fileObj.fileData = inputStreamToByte(path);
fileObj.setFilePath(path);
fileObj.setContentLengthLimit(1024 * 1024 * 10);
String name = "请查收合同文件.pdf";
WXMediaMessage msg = new WXMediaMessage(fileObj);
msg.title = name;
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = String.valueOf(System.currentTimeMillis());
req.message = msg;
req.scene = SendMessageToWX.Req.WXSceneSession;
api.sendReq(req);
}
显示问号格式,是没有设置缩略图属性。已解决
麻烦问一下,为什么我这边分享不了大文件?