如何给出NDK/本机代码与Java相同的文件权限?
我的应用程序让用户从其文档层次结构中选择intent.action_open_document
的音频文件(通常在内部存储中,而不是在我的应用程序的存储中)。一旦选择,这些文件就会在双簧管中本地处理。
我有JNI工作。我可以在Java中打开文件,然后将字节码复制到本机。
但是,如果我想直接在本机代码中打开一个文件,则必须将应用程序设置为action_manage_all_all_files_access_permission
。这似乎有些笨拙,这可能是因为我在uri> uri
- 使用getpath()
- 使用getpath()到本机,并使用
fopen()
?
我是否有可能在不需要所有文件许可的情况下从Java端继承许可以本地打开文件?我尝试发送归档的录取器,但这并没有成功,尽管可能是我的实施。
My app is letting users select audio files with an Intent.ACTION_OPEN_DOCUMENT
from within their document hierarchy (ordinarily on internal storage and not in my app's storage). The files, once selected, are then processed natively in OBOE.
I have JNI working. I can open the file in java and copy the bytecode over to native.
But if I want to open a file directly in the Native code then I must set the app to ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
. This seems a bit clumsy, it is probably because I'm sending the file path - using getPath()
on the uri
- to native and using fopen()
?
Is it possible for me to inherit the permission from the java side to open the file natively without requiring All Files Acess permission? I tried sending a FileDescriptor over but that wasn't successful, although could have been my implementation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论