0

I'm following along this thread, and calling saveFrames MediaMetadataRetriever.getFrameAtTime() returns only first frame

He is saving in Environment.getExternalStorageDirectory()+ "/videos/frames/" . Which turns out to be "/storage/emulated/0" . When I click on device explorer and "/storage/emulated" it says "Permission denied". Is there a way to access this, or is there another place that I can store the data?

Update: So here's how I solved it. I can cd to that /storage/emulated/0 using adb shell. However I cannot write to it. I change the directory name to

String folder = this.getExternalFilesDir(Environment.DIRECTORY_PICTURES) + "/frame/" ;

I can see all the files there. To retrieve the files and view them, I use adb pull /storage/emulated/0/Android/data/com.example.<app>/files/Pictures/frame

Here are more detailed discussions on storage permissions:

WRITE_EXTERNAL_STORAGE when targeting Android 10

Android Studio - How to use getExternalFilesDir

https://developer.android.com/training/data-storage/manage-all-files

https://support.google.com/googleplay/android-developer/answer/10467955

https://developer.android.com/training/data-storage

requestLegacyExternalStorage is not working in Android 11 - API 30

https://www.dev2qa.com/android-read-write-external-storage-file-example/

Arun
  • 1,599
  • 5
  • 19
  • 33
  • `Which turns out to be "/storage/emulated/0"` No. That would become `"/storage/emulated/0/videos/frames"`. – blackapps Nov 30 '21 at 22:12
  • `When I click on device explorerand "/storage/emulated" ` I have no idea what you are doing but "/storage/emulated" indeed often is not accessable. Any news? – blackapps Nov 30 '21 at 22:14
  • I'm new to Android development. Im looking for a directory to save a bunch of temporary files. Any suggestions? – Arun Dec 01 '21 at 07:48
  • `"/storage/emulated/0/videos/frames"` ? – blackapps Dec 01 '21 at 08:16
  • I can "adb shell" to navigate to /storage/emulated/0. However any when I navigate to that directory, the permissions are drwxrwx--x . I cannot change it. Any directory I create has the same permission. So my app cannot write to it. I'm using Android 10 emulator. Is there a way to change the permissions, so my app write a file to it? – Arun Dec 06 '21 at 19:53
  • `Any directory I create has the same permission`. Where are you creating which directories and how? – blackapps Dec 06 '21 at 22:17
  • Thanks for the help. Two ways: 1. using the above code: File saveFolder=new File(folder); saveFolder.mkdirs(); //This throws an en exception that it cannot create the file. Folder is /storage/emulated/0/videos/frames/ filename 2. adb shell; cd /storage/emulated/0; mkdir video; chmod 777 video; ls -al; # I see permissions as drwxrwx--x; I'm trying to write some temp files, so that I can examine it. – Arun Dec 07 '21 at 18:21
  • Android version of used device? Next time put your code in your post. – blackapps Dec 07 '21 at 19:39
  • version 10 using the emulator. thanks again. – Arun Dec 10 '21 at 04:38

0 Answers0