Dave Thomas Dave Thomas - 1 month ago 9
Android Question

Correct way to check disk space available for Android app?

A third party library out of my control is saving files in:

/storage/emulated/0/Android/data/[packagename]/files


I am aware of the different methods to check storage available on disk for internal and external storage: Android get free size of internal/external memory. What would be the correct method to check storage available for the path above?

Internal, External, or some sort of combination that depends on the device being used and it's storage types. Ie. should adoptable storage be considered in this check?

Alternatively is using the sticky Broadcast of Intent.ACTION_DEVICE_STORAGE_LOW a better solution?

Answer

Well if you have the path I believe your answer can be found inside How to find the amount of free storage (disk space) left on Android?, check the code samples there.