I can't get the total amount of data used by an Android Application (or package), because the official API support has been deleted:
http://groups.google.com/group/android-developers/browse_thread/thread/df94daae34336aad/f96a8425549c6637 (is this still the current situation?)
Getting installed app size (unsopported hack - do not use it)
So is there any way to get the current sqlite database size? I've found a getMaxSize method or getPageSize but I'm not able to find the total number of pages.
To get the amount of used space you can do SELECT (page_count - freelist_count) * page_size as size FROM pragma_page_count(), pragma_freelist_count(), pragma_page_size(); (Running VACUUM would recover the unused space and reduce the file size).
Maximum Database Size 140 tb but it will depends on your device disk size.
The maximum size of a database file is 4294967294 pages. At the maximum page size of 65536 bytes, this translates into a maximum database size of approximately 1.4e+14 bytes (281 terabytes, or 256 tebibytes, or 281474 gigabytes or 256,000 gibibytes).
Perhaps someone could verify if this is an acceptable approach, but for a while I was using this:
File f = context.getDatabasePath(dbName);
long dbSize = f.length();
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With