解决uri为content时无法获取info的问题

转载:https://www.shangmayuan.com/a/3b7fa0fcaa124e87bb8eb085.html

重要代码 


Uri downloadFileUri = manager.getUriForDownloadedFile(downId);

File file = new File(new URI(downloadFileUri.toString()));
 


Cursor c = manager.query(new DownloadManager.Query().setFilterById(downId));
if(c != null){
    c.moveToFirst();
    int fileNameIdx = c.getColumnIndex(DownloadManager.COLUMN_LOCAL_FILENAME);
    String fileName = c.getString(fileNameIdx);
    File file  = new File(fileName);
    LogUtil.d(TAG, "安装文件:" + file.getAbsolutePath());
    c.close();
}
 

猜你喜欢

转载自blog.csdn.net/xiguoqiang321/article/details/124994496