Android how much to store in internal storage - android

This may be an already answered question, but I guess I'm still a bit confused. I've read most of the questions related to storage, I understand the pros and cons of each solution, I want to use the internal storage, but I still feel stuck because of the space constraints.
I've got a working app that can save up to 200 images which can be over 100k each(so more or less 20MB of data). The app will also be restricted to the new generation of phones(Samsung Galaxy S3,4 , Iphone 5s) because of camera requirements.
I'd like to save the images in the internal storage because I don't want the users messing about with them and I'm guessing that it should be fine, but I know there can be quite restrictive limits to the allowed memory. Is 20MB too much? where can I find the amount of internal app-allocated memory?
here I found that the memory is no longer physically distinct(
external-internal storage) which raises the question how is it allocated?
A little insight would be great! Thanks

I know there can be quite restrictive limits to the allowed memory
Not since Android 3.0, for most devices. Android 3.0+ has internal and external storage sharing one partition by default, so if a device is advertised as having 8GB of space, that is available to both internal and external storage. You will find the occasional oddball device that has separate internal and external storage, but they are the exception, not the rule, for Android 3.0+.

Related

Can't allocate enough memory in JNI

I have an android native shared library (.so) that is used in an android application. This library was originally written for windows/desktop, and then ported to mobile platforms. It contains an "algorithmic" code, which works on large data set. Within the library I don't use a standard heap (malloc and friends), instead memory pages are allocated via mmap with flags MAP_PRIVATE | MAP_ANONYMOUS and then partitioned appropriately.
Now, the problem is that at some point mmap fails with error code = 12, which is out-of-memory. This happens when the total allocated memory size reaches about 650MB. I know this value if pretty large, and way above what a typical android application needs. But in my specific case this is legitimate IMHO, since this is indeed what this library/application does, and this is realized and approved by the user.
Specifically I try to run this on Samsung tablet SM-T800, which has 3GB RAM, a 32-bit armeabi-v7a architecture, and more than 7GB of free storage space (flash memory). So that technically there should be no problem.
Also this is not a problem of virtual memory fragmentation: the mmap fails when I ask to allocate additional memory chunk of as much as 16MB. So, most probably some artificial limitation is imposed by the system on how many memory pages can be allocated for the process.
So, my question is, if and how this limitation can be removed. From what I found in online documentation, there is no mention of this limitation, but I'm pretty sure it exists. I've also read in some forums that starting from Android 5.0 some applications fail to allocate as much memory as they could in older systems.
In case this limitation can't be removed, would it help to work with file mapping? Currently I store the data in source files in a compressed way, then I read it and build a complex data structure in memory. Instead I could store the whole data structure in a file (means, the file would be larger), and just map it into memory via mmap. The total size of the virtual address space would be the same, but if the limitation is not on its size, but on how many pages are allocated and not backed by a file - this could work.
As a last resort I can abandon the idea of having all the data in (virtual) memory, and manually read & lock only the data portions that I currently need, and discard those that are not used recently. But by such a way I actually duplicate the work of memory manager, since the paging mechanism does exactly this.
Thanks in advance.

Difference between internal and external memory speed on Android

I have a question about the actual speed difference between the internal and disk memory of Android devices.
It has been asked in SO 15698747, but without specific answer. I know the facts, discussed there, but I would like to get some (at least rough) data. Has anybody measured actual speed differences? To be more specific:
1/ If the disk memory is emulated portion of the internal memory (like on NEX4, NEX5 ...), is there a considerable difference?
2/ Has anybody checked the difference between the internal memory and SD cards class 4,6,10 ...? I know that different devices will start with different internal memory speed, but any estimate will be good.
Rough multiples (how many times is the internal memory faster) would suffice.

Which is faster to access a file in android, sdcard or system partition?

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.

Would a relatively large (~20MB) APK size prevent or discourage any users from installing the app?

The title says most of it. I believe packaging the basic data set into the app will result in a better user experience, rather than have people download files before they can start using the app. This is where one can start losing users. At the same time, 20MB is considered kind of a lot for Android,so I wonder if this will cause issues for some users in using the app.
I am not sure if this will cause an issue. I am an android developer who uses android phone and facebook app in my fone is almost 21MB. It does not cause any issue...However, as a developer a better approach would be to do an app that does not exceed 10MB space(Unless your app is outstanding like Facebook). You can do this by using images of smaller size,making sure you do not have any resources that you are not using(classes,layouts etc)
The size never causes issue but you may consider more:
I am a android developer and a long time Android user too. Not All Android phones have high-end processors to run app faster.
A lot of Android Phones have phone memory of 100-250MB. And the old versions of Android doesn't allow user to install app on SD card. So the user may hesitate to install your App.
Unless it is necessary try to reduce the App size.
As per my personal experience, If you are designing something astonishing and it costs even few hundred MBs on my phone, so i really wouldn't mind to give a try. Since new phones, processors and high storage capacities are continuously evolving and appearing in consumers' hands, so how can we expect applications to remain the same (tiny) in size? Let them grow (but not without any valid reason), and people would still try/buy it. There are no fixed rules or guidelines for limiting the app size, but a directly proportional relationship explains it well:
High-end graphics and feature-rich application ∝ Extra size/memory
What I think is :
The size of the app never creates issue. Again if its an extraordinary app. then surely user will surely get attracted and download your app..
But on the other side just think about the Internal Memory of the phone. There are lots of phone available that has very low internal memory(many have 150 or 180MB as internal memory). May be because of too low internal memory, they wont be able to use your application and hence you may not get big traffic.
You've got a lot of answers here so I'm just going to give you my perspective.
I would be frustrated to say the least if I downloaded a 10MB app and then opened it to find I needed to download another 10MB of necessary materials. Just make the app 20MB so I know what I'm getting into when I start the download.
Only put the bear essentials into the app if it's going to be that big. Don't require users to download high res images, language packs, etc. Just publish the bare minimum that your app requires to run if it's going to be larger than 10MB. You could even publish two versions of your app, the bare minimum at 7MB or the HOLY SH*T package at 20MB, at least users would have a choice when they went to download your app.
Spend some time looking up common practices when it comes to saving space when making an app, every little bit counts and if you can make the same app and save 5MB, your users will appreciate it. If it comes down to a lot of images, consider using this tool; http://www.getpaint.net. However I would suggest reducing the JPEG quality) rather than compress them. JPEGs aren't very squishy.
Going along with #3. Think about universally accepted methods of communication; a sideways triangle for a play button, and X for a delete button, be sneaky...save space. User's love that crap :]

Is it faster to launch an app from internal storage or from SD card?

I know that there are different classes of SD Cards and I also know, that there are many different kinds of internal storage (eg. my Dell Streak 5 has a 2GB Micro SD Card Class 4 built in).
However, is there a significant increase/decrease of speed if I have an app installed on a SD Card? Or is it the same (if you are not accounting the SD Classes)?
Like Phil say, it depends of a lot of factor.
I add : Your SDCard is a really important factor, you have to check your Read / Write Speed to see if the ratios are good. They depends a lot function the brand, the reference... of your SDcard.
A lot of people say it' s really faster to run on an SDCard.
Exemple here hith the CyanogenMod http://forums.androidcentral.com/barnes-noble-nook-color/85741-cm7-faster-internal-memory-sd-card-boot.html
You have to test function your hardware.
Good luck ;).
It depends.
No really, it does. The only way to be sure is to diagnose this yourself. IMHO I don't think there'll be a significant difference in speed if the circumstances are great. However, there probably are circumstances where the card could be significantly slower.

Categories

Resources