如何解决如何修复 SecurityException:权限拒绝:打开未从 uid 导出的提供程序
我想打开另一个带有导入窗口的应用程序并将文件发送给它进行处理。
final Intent sendIntent = new Intent(Intent.ACTION_MAIN);
sendIntent.setComponent(new ComponentName("com.example.editor","com.example.editor.ActivityImportFile"));
Uri uri = FileProvider.getUriForFile(ma,BuildConfig.APPLICATION_ID + ".provider",file);
ArrayList<Uri> uris = new ArrayList<>();
uris.add(uri);
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
ma.startActivity(sendIntent);
在第二个应用程序中,我得到了 Uri 并且我想查看它的属性,但在
Cursor cursor = context.getContentResolver().query(uri,null,null);
如果您通过应用程序选择窗口发送 Uri,那么一切正常,但是如果您通过指定确切的包和活动来打开程序,则错误是:
java.lang.SecurityException: Permission Denial: opening provider com.example.viewer.zecondary.GenericFileProvider from ProcessRecord{1b99fc80 16269:com.example.editor/u0a207} (pid=16269,uid=10207) that is not exported from uid 10204
我试过这个 android.exported=true 但这是被禁止的
如何解决?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。