Google made some fairly significant changes to the way multitasking is accessed on Android 4.0 Ice Cream Sandwich. In the new recent apps list, you can swipe apps away like cards to remove them from the list. Just like in the case of iOS, this tends to give users the feeling that they are managing tasks; freeing up memory even. However, that is just as wrong here as it is on Apple’s platform.
The recent apps list is just that, a list of recent apps with thumbnails. There is no guarantee that the apps are actually running any code just because they are in the list. When a user hits the home button, an app does not immediately enter some thing akin to Suspended mode on iOS. The process associated with an Android app remains in the background and is allowed to do any work it needs to. Apps on Android might use multiple processes, and multiple apps can share a single process.
When users want to return to an app they have left, the process is restored as a foreground app almost instantly. In a perfect world, an Android device would never run out of memory, and all these processes could live in RAM forever. This being the real world, your device will probably run short of RAM at some point. When that happens, it’s much the same as iOS. The system kills the process and the kernel reclaims the resources. The next time a user opens that app, it has to completely reloaded. This app could still be in the recent apps list, which has no bearing on whether or not its process is still running in the background.

The ways Android apps avoid being killed in the background has a parallel on iOS with the limited Background APIs. The BroadcastReceivers component lets apps wake up for a short time to run some task or another, and then shunts it back to a background state. This is useful for location check-ins or file syncing.
The other way to forcibly maintain an app in the background is the Service component. An app that is running as a Service can run indefinitely and should almost never be killed by the system. This is what makes Android multitasking unique. Regular processes will be ended before a service, and a developer can further indicate a Service’s importance by running it as “foreground,” but this requires a notification icon to be persistently visible in the notification bar. You will see this behavior with automation apps like Locale as well as with music playback.
It’s about control, and you don’t have much
Be it iOS or Android, the operating system does most of the task management for you. iOS never really allowed users to monkey around with running tasks, and even now it forces developers to very clearly declare why an app needs to exist as a non-Suspended Background process for more than a few seconds. Suspended processes are killed as needed, and the recent apps bar has nothing to do with that.
Android also closes down processes that are no longer needed, but it gives developers a few more ways to run behind the scenes. The process associated with an app is free to run whatever code it needs in the background, but if memory is constrained, it could be ended at any time. By running a BroadcastReceiver or Service, apps can be assured of a little more functionality, though. Even in Android 4.0 with its slick recent apps interface, removing an app won’t force-kill the underlying process. That’s up to the system.
The bottom line is this: don’t worry about it. The apps running in the background, be they Suspended iOS apps or Android Services, will be handled by the system in the most efficient way. Both platforms know to kill apps that are no longer needed, and removing things from your recent apps list on either platform isn’t going to help.
source : View the original article here
0 comments:
Post a Comment