Android storage - Logan676/seadroid GitHub Wiki
- check if device has a external SD card, if has scan photos from SD card by default.
- if not, scan photos from internal storage.
user has no options to choose a dir
There are three different types of external storage configurations on Android devices
- Single external storage device which only has a physical SD Card
- Single external storage device which is backed by internal storage
- Emulated primary, physical secondary
First let us unify Android terms, "internal storage", "external storage" and "emulated external storage". In Android world, directories like /storage/sdcard0/
is not internal storage, It is external storage. See the quote from CommonsWare below.
All Android devices must have an internal storage, because Android OS and applications would not work without an internal storage. "External storage" means "can be accessed by USB cable between the device and a host computer". All Android devices have external storage, whether that storage is removable (e.g. SD Card) or not.`
If you really want to find locations from internal storage, call getFilesDir() method. Obviously, that is not the case, we only want to upload photos from external SD Card here, so just ignore this and continue.
So your device has both emulated storage (instead of internal storage) and external storage on your device, and the external storage is represented by a removable SD Card. The problem with the app is it does not capable to scan photos on external storage since your device has a emulated storage which was placed as the primary storage.
So thanks for your remarkable question, which makes me think a better way to implement the photo scanning algorithm. I have to say the photo scanning algorithm does have some issues right now. So I probably use this solution instead if it turns out to be right and I will confirm that when I have time.
Every Android-compatible device supports a shared "external storage" that you can use to save files. This can be a removable storage media (such as an SD card) or an internal (non-removable) storage. Files saved to the external storage are world-readable and can be modified by the user when they enable USB mass storage to transfer files on a computer.
Caution: External storage can become unavailable if the user mounts the external storage on a computer or removes the media, and there's no security enforced upon files you save to the external storage. All applications can read and write files placed on the external storage and the user can remove them. see more
Check the following state before start to use
- Getting access to external storage
- Checking media availability
The android system only allows one file path to access either internal or external storage. If your device has both internal AND external storage then the external storage is usually accessed as a subfolder of the internal storage. e.g. The Droid Razr has both internal and external storage. The internal storage is accessed on the path /sdcard whilst the external storage (the real SD Card) is accessed via /sdcard-ext.
The paths above are an example only and totally depend on the device and how the manufacturer set up the storage. There is no way a developer can tell if storage is external or internal.
What this means is that if you backup from Password Sdafe using the SD Card option, you could actually be inadvertently saving to your internal storage. Check the actual path of your external storage using a file manager program. e.g Explorer otherwise you may have a nasty surprise if your device dies and the only backups you have are locked inside your broken phone. read more
Camera Upload Solution
- scan photos from internal storage by default. (this can solve a majority of photo backup needs)
- provide user to choose a specific dir to upload photos (includes SD card or USB removable)
Android手机支持SDcard。目前很多手机厂商把SDcard集成到手机中,当然有的手机同时也支持可插拔的SDcard。这就有了内置SDcard和外置SDcard之分。当手机同时支持内置和外置SDcard时:调用系统APIEnvironment.getExternalStorageDirectory().getPath();
得到的是SDcard路径为内置的SDcard路径。
由于Android系统的碎片化,很多手机厂商处理SDcard的路径都不相同,也没有办法通过/system/etc/vold.fstab文件中的配置信息来确定SDcard的路径,因为这个文件的名字也不唯一。
外置SDcard路径的获取方法实现
manufacturer | path |
---|---|
Asus Transformer | /Removable/MicroSD |
HTC Velocity LTE | /mnt/sdcard/ext_sd |
Huawei MediaPad | /mnt/external |
Intel Orange | /mnt/sdcard2 |
LG Prada | /mnt/sdcard/_ExternalSD |
Motorola Razr | /mnt/sdcard-ext |
Motorola Razr i | /mnt/external1 (zeigt es sogar korrekt an!) |
Motorola Xoom | /mnt/external1 |
Samsung Note | /mnt/sdcard/external_sd (und Pocket und Mini 2) |
Samsung Note II | /storage/extSdCard |
Samsung S3 | /mnt/extSdCard |