I am making an app that stores a WAV file. It makes a folder in external storage on my phone and then stores it. It does this successfully. However when I plug in my phone to the computer via USB on MTP, the folder and any files made by my application don't show. What should I do?
I cannot use the following code because my API min cannot support DIRECTORY_DOCUMENTS. Is the trick to making them viewable on the computer just changing the filepath? If so, what should I enter for the file path? :
protected String mDir = Environment.DIRECTORY_DOCUMENTS;
protected File mPath = Environment.getExternalStoragePublicDirectory(mDir);
protected void writeLogFile(String filename) {
File f = new File(mPath, filename + ".txt");
f.getParentFile().mkdirs();
try (BufferedWriter bw = new BufferedWriter(new FileWriter(f, false))) {
// Details omitted.
} catch (Exception e) {
e.printStackTrace();
return;
}
makeText("Wrote " + f.getAbsolutePath());
}