- 微信聊天记录中的文件,用其他方式打开,分享到自己的app,获取不到文件?
这是我获取的文件路径 content://com.tencent.mm.external.fileprovider/attachment/1_双模vd108 87.pdf 获取文件的方法 File destFile = new File(getFilesDir(), "copied_file.pdf"); // 修改文件名和类型 try ( InputStream inputStream = getContentResolver().openInputStream(uri); OutputStream outputStream = new FileOutputStream(destFile)) { Log.d(Constents.LOGOUTCS, "inputStream" + inputStream); Log.d(Constents.LOGOUTCS, "outputStream" + outputStream); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } } catch (Exception e) { e.printStackTrace(); } 在 getContentResolver().openInputStream(uri) 报错如下 java.lang.SecurityException: Permission Denial: reading android.support.v4.content.FileProvider uri content://com.tencent.mm.external.fileprovider/attachment/1_双模vd108 87.pdf from pid=26273, uid=10316 requires the provider be exported, or grantUriPermission()
10-15 - Android11后微信里面的文件,用其他应用打开分享文件到我自己的app,读不到这个文件?
这是我获取的文件地址 content://com.tencent.mm.external.fileprovider/attachment/双模vd108 87.pdf getContentResolver().openInputStream(uri) //读取uri文件,提示报错 报错信息如下 Permission Denial: reading android.support.v4.content.FileProvider uri content://com.tencent.mm.external.fileprovider/attachment/1_双模vd108 87.pdf from pid=14656, uid=10298 requires the provider be exported, or grantUriPermission()
10-14