O'Reilly logo

Android Application Security Essentials by Pragati Ogal Rai

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

File

An application can use Android's filesystem to store and retrieve data as well. The java.io package provides this functionality. This package provides classes to write and read different data types from a file. By default, files created by applications are private to the application and cannot be accessed by other applications. Files persist reboots and application crashes; they are only removed when the application is uninstalled.

Creating a file

The following code snippet shows how to create a file. As I have said before, by default, all files are private to the application.

FileOutputStream fOut = openFileOutput("MyFile.txt", MODE_WORLD_READABLE);

The file MyFile.txt will be created in the /data/data/<application-path>/files/ directory. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required