I have a text file with some data that I want to copy in an SQLite database.
I can not access to files on "downloads" directory of the phone I have an Permission denied exception (I use the path provided by the Device File Explorer of Android-Studio-3.1.4 that allows me to create a file, get its path, edit the content but not saving it!).
Some forums tells that I have to put the file on data/data/app-name but I technically failed to do that.
I tried to create a new file in my project, but still I do not know how to access it with code.
FileInputStream file = new FileInputStream("/storage/self/primary/Download/file.txt"));
before this line I tried to add:
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
But this is not the solution.
So where should I put the file? what will be the right path? and what are the required permissions that I should add in the manifest?
thanks.