android sdk 分享文件,文件类型在手机聊天界面显示成问号?
[图片] 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"; //请查收合同文件.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);
}