How is the size of cache and data calculated in the application properties?
I save all my data to the SD card, but Android shows me that I'm constantly using 4 KB, but on the SD card are about 50 KB. The same with the cache! I put a 3 MB picture in there. But my cache size is zero!
I think I'm using the correct directory: /mnt/sdcard/Android/data/my.package.name/files and /mnt/sdcard/Android/data/my.package.name/cache.
Has this changed in Android 4.0.x?
See this screenshot:
I believe the Cache size is the size of the Internal Cache directory that is returned by http://developer.android.com/reference/android/content/Context.html#getCacheDir()
I think you've used:
http://developer.android.com/reference/android/content/Context.html#getExternalCacheDir()
The application properties page only shows usage for the internal memory, not for the external memory (SD card).
I don't know exactly why they chose to do it like this, but one reason would be that the SD card is not managed to the same degree: while you can get Android to manage SD card data for your application, you can also bypass it and use a custom folder structure.
Additionally, external memory is usually far larger than the internal memory, and can be managed by the user, so SD card usage is probably not all that important anyway.
Related
A friend of mine gave me a corrupted SD card. My windows 10 cannot detect it and on android it asks to format the corrupted SD card. Is there a way to partially or, best case, fully recover the data on this card?
Kind regards
Kurt
First thing you need to determine is if it's detected with correct capacity in disk management:
This is what to look for in Disk Management
If not then this is probably not DIY-able. A data recovery lab still could get the data by scraping off the back layer and soldering wires to a special reader.
If it is detected, my advise would be to create a sector by sector image file. Then, any decent file recovery software should be able to scan that image file as if it were a regular drive and recover the data.
To create such an image in Windows you could use Win32 Disk Imager, in Linux ddrescue. Any decent file recovery tool would allow you to create a drive image too.
I'll mention DMDE as an example as it is also a very good tool to analyze the image file with and recovers upto 4000 files for free (as long as they're in the same folder).
Is there a way to prevent android os from indexing files on a sd card? We have an application that uses offline map tiles and even for just one city its about 3 million files.
Every time we reboot the device or insert an sd card the android.process.media process runs for about 2 hours trying to index everything on the sd card. Which also for some reason causes the media storage app to fill up all the hard disk space on the device.
We've tried using a .nomedia file in our map tiles folder but it does not seem to make any difference.
This is a total hack but what works for us is moving whatever you don't want indexed into the Android/data folder on the sd card.
I have one simple question. If i have one file in system partition of android and if i copy the same file on sdcard, which will be faster to access?
Please answer this question.
Thanks in advance
The difference will be negligible. In any case, most newer devices have just one storage onboard the device, which is partitioned. In such devices, the need to access a separate SD Card goes away, as the memory is the same as the system storage.
On devices with an SD Card, there may be a very minute delay in accessing the file, but it will be negligible in pretty much any scenario.
You will not be able to really notice the access speed difference between accessing file from internal memory and SD Card.
With internal memory you will get added advantage of a security as it won't be accessible for other applications or you cannot access it by mounting.
The answer is Internal phone memory
because disk management(for phone ) is always better for internal memory as compared to SD card, So it is faster to access internal memory but you will not be able to notice the because difference is in mili seconds
With internal memory you will get advantage like user can't see your file until unless device is not rooted.
As stated, the time difference is not noticeable. However, a simple law of physics (and EE) will tell you that the longer the distance is (in this case the I/O bus), the longer it will take in time. Thus, the SDCard is slower than anything on the motherboard, even though it is measured in miliseconds.
I have found the SDCard is best used for static storage of your media files, and apps should be installed on the phone making them run as fast as possible, even though you can move some apps to the SDCard.
The speed is not noticeable unless you are coping the very large video files. The SD card speed is measured by class like:(Class 4, 6 or 10), the class 10 have higher speed as 10MB/S and class 2 have speed around 2MB/S. So, for good class of SD card, the speed gap is less. However, normally phone memory is faster than the SD card.
I've looked around and have noticed that the max size for an apk is 50MB, but I am curious as to how much application space an app can download. Can one app take up all of the application storage or does it need to download additional content into the internal storage and/or sd card?
Thanks
The APK limit has been increased from 50MB to 4GB (see http://androidcommunity.com/android-market-upgrading-app-size-limit-to-4gb-20110511/ ), so one would presume that an app could store up to 4GB.
That said, you should be storing any large files on SD card (or similar) instead of taking up the app space (some phones this is shared space, such as the Galaxy Nexus.) Doing it that way won't have any limits except the space available on the SD card from my understanding.
My app needs to save files that will range from about 2-20mb. When I tried to do this I was getting an OutOfMemoryException. I did some reading and it's looking like Android has a file size limit of 1mb. Is this correct? If so, is there a way around this limitation, other than splitting up every file into 1mb chunks?
The main application need to be small, like < 1 MB but you can save as many files as you want and as large as you want as long as you save them on the memory card. The available space that can be used for applications (and other secure data) is limited, usually under 128 MB. So basically you need to keep your application small and put the large part as an add-on or extra files that can be put on the memory card. If you application will use 20MB from the available space it will drastically reduce the number of people that will use it.
OutOfMemoryError means you exceeded the VM's RAM budget, which is 16MB or 24MB depending on what device you're on. It has nothing to do with file sizes.
The 1MB limit you're probably referring to is the maximum size of a compressed asset in an APK file.
Files in your app-private data area or on external storage can be as large as the filesystem will allow them to be. (I've heard the FAT32 implementation Android uses for SD cards has a 2GB limit for individual files, but don't remember the resolution of that thread.) Available disk space will likely be a larger concern.
Going back to your original problem, check the logcat output (via adb logcat or DDMS) to see if there are any messages from the garbage collector right before the OOM fired.