how to create a file with world readable permission under subdirectory of files directory

前端 未结 4 994
迷失自我
迷失自我 2020-12-29 07:05

I need to create files under myapp/files/subdir with global permission in my application. I do this because I use external applications to open some files Using this

<
4条回答
  •  情歌与酒
    2020-12-29 07:58

    If you are running it on a rooted device, change file permissions using:

    Runtime.getRuntime().exec("chmod 777 " + PATH + fileName);
    

    Or try File.setReadable(), File.setWritable while creating the file.

提交回复
热议问题