Skip to content Skip to sidebar Skip to footer

Phonegap Camera Android Kills Cordova

I'm working on several Phonegap projects. In some of them I'm using the camera functions. I'm puzzling with this issue (from the Phonegap documentation): Android Quirks Android u

Solution 1:

Not sure if there exists a good answer to your question but I will try.

It depends on quite a few factors when apps get killed to free memory. First and major factor is how much the camera activity needs to run. The camera app itself is on most devices (though it varies) around 10MB. This is the size of the app in memory and not the size it takes when running the activity, which would be logically a bit bigger. It also depends on the camera itself and the amount of memory needed to store the actual photo, lets assume the photo is around 4MB when stored, and raw around 20MB. This gives us an approximate upper limit of 30MB for the app running, though is speculation and I will check this myself later and edit it.

A good reference about memory related to Android you can find here https://01.org/android-ia/user-guides/android-memory-tuning-android-5.0-and-5.1 They advice to always have 500MB or more memory available to run apps, this is of course for all apps you are running and not for one specific app.

Than the point that GC starts removing apps from memory, this happens very close to the actual bounds of the memory, when less than 5% is still free, this value is emperical by my own experiments. First it kills apps that are still in cache but not longer required, only as last resort it kills apps that are active as well.

My assumption is that your app will be killed below approximately 50MB of memory free, though I have to stress that there are many assumptions here and there is no general way to tell you a good answer for each device with each kind of camera and each version of Android.

Hope it helps, fear it does not.

Solution 2:

Try to find a plugin that do not launch the system camera app. Instead use a custom camera activity with only limited features to reduce memory usage.

Post a Comment for "Phonegap Camera Android Kills Cordova"