#First Things First
You may have some misconceptions about how Android works and what's really happening when a service is running or an app is in the background. See also: Do I really need to install a task manager?
Most apps (e.g., ones you launch manually) have their current Activity put into the background when you switch to another app or the homescreen. Activities consume some memory, so that you can go back to the app and pick up where you left off. Activities are usually not able to run computations in the background, so no CPU or battery is used for them. If battery life or CPU performance is your concern, you don't need to worry about these apps! You don't need to worry about memory, either; Android will automatically kill the app and free the memory if the system is running low.
If the app in background is running a service, that may be a different story. Well-designed services spend most of their time sleeping, waking up for the occasional check (new social media notifications, for example). However, poorly designed services may run more often or perform syncing operations that you don't want, affecting battery life and your data usage. If you've got a rogue service you may want to try one of the solutions below.
#Solutions
If you're sure you want to make this app stop at all costs, you can try these methods.
###Uninstall
When an app does something you don't like, whether running in the background on startup or something else, your first option is to uninstall it. Problem solved! You can remove system apps if you have root, most easily with Titanium Backup, but be careful to remove only carrier bloatware and not critical system apps.
However, if you want to be able to use that app then this is not an option: keep reading.
###Ping the Developer
Some of the greatest daemons that come with Android are services that run in background for no reason or when a simple interval check with Android's AlarmManager would be sufficient. We need to kill them all with fire, and not by ignoring them. Everything that does not involve a fix by the developer is just a hack that will result in other negative side effects. If you contact the developer with your problem, they can fix the app and you can go on using it normally. That's a win for everyone involved.
###Manually Killing Apps
First, note that many apps will close completely if you Back out of them rather than using the Home button.
If you are running Ice Cream Sandwich or Jelly Bean, you can go into Settings, hit Applications, and manually shut down the app by tabbing over to the running apps. Alternatively you can hit the Recent Applications button and swipe them off the screen to close them. In older versions of Android there may be a built-in Task Manager added by the manufacturer to accomplish the same thing, or you can download a task manager app to do so. For services, look at Settings -> Applications -> Services
.
WARNING: Do not use automatic task killers! Automatic task killers run in the background (exactly what you don't want) and kill apps whenever they start. Most of the time this makes things worse, because apps often consume more resources when they're starting up compared to when they're sitting idle. Services that run automatically and are restarted by the system will be killed over and over, wasting your battery. Similarly, apps that receive system events known as Intents (such as network coverage and connectivity changes) will be killed every time they start up to receive an event. Nothing good can come of it.
A possible exception is automatic tasks that execute only when you, the user, perform a specific action. In essence, they're just making manual task management easier for you. An app like Tasker or Llama can be used to end activities when you switch apps, for example, ensuring they don't stay around in the background. Instructions for Llama:
Create a new
Event
. Add the condition calledActive App
, and choose the statusApp stopped or in background
. Choose the app you want to focus on. Next, add anAction
. SelectKill Application (root privileges)
, then select your app again.
Now, whenever you leave the app, Llama will kill it.
###Editing Autostarts and Intents
As mentioned above, some applications may start when they receive Intents (system events). By using an app like Permissions Denied you can alter which permissions apps can request, which in turn limits which events they can receive. Or you can use an app like Autostarts (paid app) to edit specifically which Intents will be sent to which apps. For both solutions, you'll need root access.
Other options:
(Autostarts source code is also available here: https://github.com/miracle2k/android-autostarts)
WARNING: This can cause apps to stop working or inhibit wanted functionality. Proceed with caution, especially with critical system apps.
###Freezing Apps
You can use an app like Titanium Backup or App Quarantine to complete freeze apps so that they can't run at all. If you want to use them you have to un-freeze them first.
WARNING: Do not do this with critical system apps! Your device may fail to boot.
###Put Apps into Hibernation
Greenify (require Android 4.0+ and ROOT privilege) use a different approach called "Hibernation", from traditional "Freezing".
You can safely hibernate any non-system app you do not want it to run stealthily (via persistent services, broadcast receivers, alarms and so on), effectively equivalent to "freezing", while still keep all its entrances (launcher icon, sharing target, etc) and fully functional when you explictly run it, without the need to un-freeze it first.
WARNING: Do not hibernatize alarm clock apps, instant messaging apps, and other apps whose basic functionality relies on background mechanism (timer, system events, "push", etc) to work.
#The Bottom Line
Android is designed to take care of app management for you. In all but the most extreme cases you shouldn't need to worry about it. When there is a problem, we advise you to go for the simplest solution — uninstalling. All other solutions are hacks around what Android is designed to do. Maybe one day Android will have official support for managing services but, until then, be careful.