question

CtrlMovie avatar image
CtrlMovie asked

External Storage - Free Space

We like to bring our game to the Amazon Fire tablets. Game works great so far. However it needs around 4.3 GB of storage space for game data (mostly videos). We like to check in advance if there's potentially enough storage space on the device and warn the user. The app is using the Android NDK and we are using the following function to check the external storage path:

struct statvfs driveInfo;
int ret = statvfs(path.c_str(), &driveInfo);
if (ret == 0) {
// f_frsize is block size in bytes;
// f_bavail is number of free blocks
space = driveInfo.f_frsize * driveInfo.f_bavail;
}

While is works great on all kinds of Android phones, it reports 1.7 GB of free storage on an Amazon Fire HD 10 tablet even though the tablet still has 27 GB free. And the funny part is, when we just start loading the data, the value reduces to 0 GB and then jumps back to 4.7 GB.

Can anybody explain that behavior to me? Is there are better way to check the actual free storage on the device?

Martin

android
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers