It is possible to get the Android device Internal Download Folder path?
To see the location of your Download folder, tap the three-dot menu next to one of your downloaded files and go to File info. The /storage/emulated/0/Download path is the default for many modern Android devices.
The file path for your downloaded files (for example, C:\Users\[your name]\Downloads) is listed under Location. In Microsoft Edge Legacy , select Settings and more > Settings . Then scroll down to the Downloads section.
The exact location of the data stored on an Android phone may vary in different models and versions. But in most cases, you can see the internal storage of an Android phone: Navigate to My Files to view internal storage as well as SD card and Network storage. Here, tap Internal Storage to see your files and folders.
If a device has an SD card, you use:
Environment.getExternalStorageState()
If you don't have an SD card, you use:
Environment.getDataDirectory()
If there is no SD card, you can create your own directory on the device locally.
//if there is no SD card, create new directory objects to make directory on device
if (Environment.getExternalStorageState() == null) {
//create new file directory object
directory = new File(Environment.getDataDirectory()
+ "/RobotiumTestLog/");
photoDirectory = new File(Environment.getDataDirectory()
+ "/Robotium-Screenshots/");
/*
* this checks to see if there are any previous test photo files
* if there are any photos, they are deleted for the sake of
* memory
*/
if (photoDirectory.exists()) {
File[] dirFiles = photoDirectory.listFiles();
if (dirFiles.length != 0) {
for (int ii = 0; ii <= dirFiles.length; ii++) {
dirFiles[ii].delete();
}
}
}
// if no directory exists, create new directory
if (!directory.exists()) {
directory.mkdir();
}
// if phone DOES have sd card
} else if (Environment.getExternalStorageState() != null) {
// search for directory on SD card
directory = new File(Environment.getExternalStorageDirectory()
+ "/RobotiumTestLog/");
photoDirectory = new File(
Environment.getExternalStorageDirectory()
+ "/Robotium-Screenshots/");
if (photoDirectory.exists()) {
File[] dirFiles = photoDirectory.listFiles();
if (dirFiles.length > 0) {
for (int ii = 0; ii < dirFiles.length; ii++) {
dirFiles[ii].delete();
}
dirFiles = null;
}
}
// if no directory exists, create new directory to store test
// results
if (!directory.exists()) {
directory.mkdir();
}
}// end of SD card checking
add permissions on your manifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With