jensstein / oandbackup

backup manager for android
Other
543 stars 198 forks source link

Default Backup Location #89

Open DJaeger opened 9 years ago

DJaeger commented 9 years ago

The Backup Location should default to external storage if available, so that it doesn't consume the mostly not very big space on internal storage. Additionally it will not be deleted, if you restore or reflash your device.

jensstein commented 9 years ago

it defaults to Environment.getExternalStorageDirectory() with changes to android sometime around version 4 that external storage might well be a partition on the built-in storage. https://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory() i don't think there would be any good (meaning sane and practical) way to determine whether a connected sdcard would be a better default location if getExternalStorageDirectory() doesn't point to it. and if you have a device where getExternalStorageDirectory() points to a partition on the internal storage, that partition is probably not overwritten or repartitioned by non-stock recoveries (it might be with the vendor-provided ones).

DJaeger commented 9 years ago

But this is always the primary external directory, which in common is an additional partition on the internal storage. There are ways to determine an secondary external storage, which should be an sd-card.

As of Android 4.4 it is really simple to get secondary storages: https://source.android.com/devices/storage/index.html#multiple-external-storage-devices

Some ways to determine it, can be found here (I don't read all, but I think there are also some reliable ways to determine secondary external storage for older Android-Versions): https://stackoverflow.com/questions/11281010/how-can-i-get-external-sd-card-path-for-android-4-0 and here: https://stackoverflow.com/questions/7450650/how-to-list-additional-external-storage-folders-mount-points

With saving to an SD-Card you are safe, that really no reinstallation, reflash or what else will delete you backups. Also it will make it possible to move your card to an new device and simply restore all your data. Or to have an backup-card, that you store at home and plug it in one time per week, make an backup, plug it out and dont care about loose your data if your phone get lost. And that all really standalone without an computer or web-solution. And you dont have to search your path to the sd-card manually.

DJaeger commented 9 years ago

It could be an simple checkbox in the settings to switch between integrated (emulated external) and external (not emulated external) storage

jensstein commented 9 years ago

yes, i know you can find out whether there's an sdcard present. but how would you determine whether it's a better default location? what if a user has 32gb internal storage and a 2gb sdcard connected. i don't really think a checkbox would make sense. if the user has to make a choice then it's not a default any longer (the checkbox would have to have a default value too) and you could just as well just set the path to somewhere on an sdcard from the preferences. if you use a stable version of a widely used recovery program then your internal storage is as safe as it can be. and if you use unstable software to handle those files then i guess an sdcard wouldn't be a much safer option. (also, as raspberry pi users know, they sometimes don't last that long) i get that there are many advantages to using an sdcard, but i can't see how determine whether it's a better default location in a sane and practical way.

DJaeger commented 9 years ago

Good point. You could check the Storage-Space in addition and choose depending on that, but this would make the choose more complex.