I have been sufferring in one problem for several days. Currently I'm running in the source code of "Settings" on Android2.2.
In AdroidMenifest.xml, we can see:
android:sharedUserId="android.uid.system"
With this, many permissions can be accessed for the activities in Settings. But with this statement, the sd card can't be accessed for Read/Write, I have tried to read files in directory
File f = new File("/mnt/sdcard/"+filename);
or
File f = new File("/sdcard/"+filename);
But all of them don't work, I got an exception telling me that the file didn't exist (I have already put the file there).
If I delete android:sharedUserId="android.uid.system"
, then I can access the file successfully . However, I need the android:sharedUserId="android.uid.system"
to make the other activities run well.
Does anybody happened to meet the same problem, and have you solved it? Thanks!
The system user can not access the SD card, because if the SD card gets unmounted it may need to kill any processes that have files open on it and we don't want system processes being killed like that. If you want to access the SD card, you need to not use the system shared user ID.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With