I am failing to create a file in SD card root (/storage/5DF1-1011/
).
Is this even possible or am I limited to the app folder (/storage/5DF1-1011/Android/data/com.my.test.sdcardtest/
)?
I am failing to create a file in SD card root (/storage/5DF1-1011/
).
Is this even possible or am I limited to the app folder (/storage/5DF1-1011/Android/data/com.my.test.sdcardtest/
)?
yes you can create file in external storage of Android.
for that you need to give first permission in manifest :
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
after that you can create file in external storage :
String filePath = Environment.getExternalStorageDirectory().toString() + "/fileName.mp3";
File file = new File(filePath);
if (!file.exists()) {
file.createNewFile();
}