开发者

Is it possible to change the permission on files in an Android app's internal storage?

开发者 https://www.devze.com 2023-01-05 02:32 出处:网络
I downloaded a file with an app and stored it inside of its internal storage, but the file is set with -rw------- and I want to change those permissions so is it possible? I know that using external s

I downloaded a file with an app and stored it inside of its internal storage, but the file is set with -rw------- and I want to change those permissions so is it possible? I know that using external storage is an option but I want to know if I can do it with internal storage too. Thanks for the help.

Edit: If it turns out that I can't change the permis开发者_Go百科sion is there some shared region of internal storage that I could use? I would like to not force the Android device user to have an SD card.


Internal storage is always private to your application.


I found out that the follow bit of code will change the permissions on the file based on what you set the second parameter to be.

FileOutputStream fileOutput = openFileOutput("myApp.apk", Context.MODE_WORLD_READABLE);

The four options for the second parameter are: MODE_PRIVATE, MODE_APPEND, MODE_WORLD_READABLE, and MODE_WORLD_WRITEABLE.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号