I’m developing an augmented reality app where users can shoot a photo with their mobile device to add 3D objects on it.
The problem is that on Android, when the user choose to shoot a photo from my app, the app is put on the background and often closed instead of being kept in memory to handle the photo taken.
I know it is because of Android killing apps to free ram… But is there a way to prevent the killing of my app ?
Even on Ipad 2 with its 512Mo of ram IOS doesn’t do this brutal killing thing : after the shooting it goes back smoothly to the app.
Whereas Android does it with my 1Go of ram phone.
The only way to stop android from killing your apps is to reduce the memory footprint of your game. I don’t believe you can override this core android behavior. If the app takes up more than 50 MB (roughly) , android will kill it when paused. use the profiler to see if you are crossing that limit. If you do cross 50 MB, one simple way of avoiding the high memory usage is to load and unload texture data of your assets dynamically. this will require some coding. Look up Resources.Load and Resources.UnloadAsset functions.
make sure you do the loading and unloading of assets in couroutine functions.