I'd like to get the device storage capacity as displayed in Settings -> Storage - usually something like: 32 / 64 / 128 / 256 GB.
I used this post (and a few similar ones): It is possible to get total storage capacity?
I've got this code:
StatFs stat = new StatFs(Environment.getDataDirectory().getAbsolutePath());
long gb = 1024 * 1024 * 1024;
long size = stat.getTotalBytes() / gb;
This returns 47GB on a 64GB Samsung S8 and 111GB on a 128GB Huawei Mate 10 - not what I was looking for.
How to get the 64GB / 128GB values? Thanks!!
Update
This is the same as this question: How to get exact capacity from storage. Unfortunately the accepted answer states that it's not possible to get the storage info - I was hoping to get a different answer .. maybe not using StatFs but some other way.