Home:ALL Converter>How to avoid Jelly Bean to kill my application when in background?

How to avoid Jelly Bean to kill my application when in background?

Ask Time:2013-03-06T03:11:37         Author:Carlos A Ferreira

Json Formatter

I have a voice recognition application, when the user press the home button it goes to background and still listening for commands. It works fine on 2.3 and up except in Jelly Bean that kills the activity in a few seconds(on ICS can also happen, but usually keeps running). Is there any way to avoid Jelly Bean to kill my activity?

Thanks,

Carlos.

Author:Carlos A Ferreira,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/15232157/how-to-avoid-jelly-bean-to-kill-my-application-when-in-background
CommonsWare :

\n Is there any way to avoid Jelly Bean to kill my activity?\n\n\nAndroid will terminate your process sometime after it goes into the background. This is completely normal and expected. The precise timeframe will vary based upon device, OS version, and what else is going on.\n\nYou are welcome to attempt to rewrite your application to move the voice recognition into a service, perhaps even a foreground service (via startForeground()). Using a service will increase the lifetime of your process somewhat. Using a foreground service will increase the lifetime of your process significantly.",
2013-03-05T19:20:44
yy