Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android´s MODE_WORLD_READABLE

Tags:

android

I am building an app with API level 19 and I am using:

 // download the file
                input = connection.getInputStream();
                fOut = openFileOutput("example.json",MODE_WORLD_READABLE);

it says that "The field Context.MODE_WORLD_READABLE is deprecated", is there some alternative or adding the @SuppressWarning there is not problems to use it? Thank you

like image 919
user3733523 Avatar asked Jun 29 '14 19:06

user3733523


1 Answers

Making files world-readable can be a security flaw, which is why Google no longer endorses the practice. In particular, I cannot think of a reason why a JSON file would need to be world-readable.

If you want an app to make file content available to other apps, use FileProvider.

like image 104
CommonsWare Avatar answered Oct 20 '22 21:10

CommonsWare