1

I am creating an app which takes photos using camera activity and I am saving those photos into the app folder inside internal storage. But if the internal storage is not free to save the image, does the android automatically saves the image into the sd card or not? If it does not how can I save images taken form my app to be saved into sd card if internal storage is not available? Thank you.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
Mithun Adhikari
  • 521
  • 6
  • 13

1 Answers1

1

No, the Camera app on Android will not automatically choose external storage when internal storage is full. It is your responsibility to check the available disk space and choose the best medium for EXTRA_OUTPUT FileProvider URI before you launch the ACTION_IMAGE_CAPTURE intent.

But you should remember that the app that will fulfill your intent may actually do whatever they want. Even the system (preinstalled) camera apps on different devices choose to respect or not to respect MediaStore.EXTRA_OUTPUT. Worse, the user is free to install a 3rd party app and use it to handle your intent, so you can never be sure how seriously your EXTRA_s will be taken.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • I am stuck here. Because I could not save the images onto sd card but only on the internal storage. How do I do that? And thanks for the answer. – Mithun Adhikari Dec 10 '17 at 05:23
  • What could prevent you from saving the photos on the sd card? In the worst case, you must [request one additional runtime permission](https://stackoverflow.com/a/40201333/192373). – Alex Cohn Dec 10 '17 at 08:09
  • I am using `getExternalFilesDir(Environment.DIRECTORY_PICTURES)` method to get the address of sd card but it returns the address of app folder location. And yeah I have used ` ` permission and runtime permission as well. – Mithun Adhikari Dec 12 '17 at 16:20
  • please see the linked [answer](https://stackoverflow.com/a/40201333/192373), I believe it has all info that you need. – Alex Cohn Dec 12 '17 at 16:29