1

I'm trying to delete a file in android storage. But the file is not getting deleted. I trapped on this issue almost 3 days. I tired all the solution as of my knowledge, but nothing hellps. Your help will be highly useful to me thanks in advance.

I used the below code to delete

 String path = "/storage/emulated/0/Recordings/Call/Two.mp3";
        File fdelete = new File(path);
        if (fdelete.exists()) {
          boolean  b = fdelete.delete();
          if (b) {
             System.out.println("file Deleted :" + path);
          } else {
             System.out.println("file not Deleted :" + path);
     }
}

And the permission I used in manifest are

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.STORAGE" />
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
Anand
  • 4,355
  • 2
  • 35
  • 45

0 Answers0