androidfileinputstreamfileoutputstreamdata-security

Store data that nobody can access apart from me in Android


I have a question and I hope you can help me with it.

I created an aplication that need to store a data in the Android device THAT NOBODY CAN ACCESS apart from me in the source code.

I search for it a I found the FileOutpuStream and FileInputStream solution :

private String file="mydata", data;


FileOutputStream fOut = openFileOutput(file,MODE_PRIVATE);
                fOut.write(data.getBytes());
                fOut.close();

and

FileInputStream fin = openFileInput(file);

My question is where is the file created store ? And is it sure that nobody can access it even if they find the file in their device ?


Solution

  • The file is created in the phone's internal memory and only your app can access it.

    Pretty sure it's not 100% reliable as it's just a file, you'd better find something else. Rooted android can access to whatever file they want.

    EDIT: Read the two first lines of https://developer.android.com/guide/topics/data/data-storage.html#filesInternal