I have made an app that runs in the background. The purpose is to intercept incoming calls. After a while Android kills the service/app if it's not "active" for a while. Any way to avoid this in basic4android?
preguntado el 08 de noviembre de 11 a las 16:11
Set the service to be a foreground service. Run Service.StartForeground from the service module When you are finished processing use:Service.StopForeground to stop the service from being a foreground service.
The easiest way to avoid this problem is to place a notification icon in the top bar. Android will not kill processes that have a notification icon unless the phone is running very short on memory.
However, you may want to make this icon an option to the user (default: on), because higher end phones won't kill processes unless they have a memory shortage anyway.
Unfortunately, I don't know how to implement this.
 You could also make the app do something completely pointless every 15 minutes, like set a useless variable. This would classify the application as active to the system. You'd still have to worry about low memory situations, though.