简体   繁体   English

使用NDK在Android上的SDCARD文件权限

[英]SDCARD files permissions on Android using NDK

I'm trying to open file on proprietry SDCARD usign standard method: hFile= open(filePath, O_RDWR|O_NONBLOCK|O_DIRECT); 我正在尝试使用专有SDCARD使用标准方法打开文件:hFile = open(filePath,O_RDWR | O_NONBLOCK | O_DIRECT);

Sdcard is our proprietry card which was created using external tool, and when card is inserted ingo Android phone, the permission of file is: ----rwxr-x system sdcard_rw 65536 2011-11-06 12:13 IMSP I guess Android decides on this permission. sdcard是我们的专有卡,它是使用外部工具创建的,并且在将卡插入Android手机中时,文件的权限为:---- rwxr-x系统sdcard_rw 65536 2011-11-06 12:13 IMSP我想Android会决定在此许可下。 Anyway, file can't be open for writing Is any way to change the android application userid or groupid? 无论如何,无法打开文件进行写入是否可以通过任何方式更改android应用程序的userid或groupid?

Regard, Costa. 问候,哥斯达黎加。

you get the path to the File used in the File() by calling a system method 您可以通过调用系统方法来获取File()中使用的File的路径

not all files (extern storage) go to where they say the are but if you fiddle with it like File.list() or something on what the Android gives you for external storage prob can figure it out 并非所有文件(外部存储)都转到它们所说的位置,但是如果您像File.list()那样摆弄它,或者Android为您提供的用于外部存储的东西可以解决这个问题

Ok, the solution is simple, just add: 好的,解决方案很简单,只需添加:

uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" 使用权限android:name =“ android.permission.WRITE_EXTERNAL_STORAGE”

To the manifest file 到清单文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM