TimeLapseCamera icon indicating copy to clipboard operation
TimeLapseCamera copied to clipboard

SD card support

Open Winqov opened this issue 1 year ago • 1 comments

Issue: The internal storage of my phone is very limited. To counter that, I have a 128 GB SD card, but this app doesn't take advantage of it for now.

Solution: Adding SD card support would solve the issue.

My patch: I have being investigating how to do it for myself and I have successfully achieved something.

/app/src/main/java/at/andreasrohner/spartantimelapserec/data/RecSettings.java LINE 150

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
	StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
	List<StorageVolume> storageVolumeList = storageManager.getStorageVolumes();
	if (storageVolumeList.size() > 1) {
		StorageVolume storageVolume = storageVolumeList.get(1);
		projectPath = storageVolume.getDirectory().getPath() + "/Pictures/";
	}
}

I made a build with this patch, and it's working fine so far on my android 11 device. With my SD card inserted, the app will record the videos to it, if I extract it, the videos are recorded in the internal storage. No extra permissions, the app already have write access to the "Pictures" folder in the SD card.

As you can see, this method requires API 30 for "getDirectory()", so there is a check, and if not matched, it is ignored. If you ask me, that's better than no SD card support at all, but I'm not an android dev, so maybe there is a better option.

My device: Redmi Note 7 Android 11 - DivestOS, a soft fork of LineageOS

Winqov avatar Jun 15 '24 23:06 Winqov

in case you want to record in jpg mode, you can try the version in the beta branch which @andreasb242 is working on. It also supports SD

woheller69 avatar Jun 16 '24 04:06 woheller69