I am writing an application that should upload pictures taken by the camera which are stored in the DCIM/Camera folder on both internal memory and SD card.
This means that before every upload all available storages have to be checked for presence of any images.
I use Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
to access the primary storage, which can be either SD card or internal memory (depends on device).
From documentation:
Note: don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.
My question is, how can I access the secondary storage to check for presence of images in the DCIM/Camera folder without hard-coding the path, which does not work well since the SD card might be emulated in different path.