Android O keeps apps under control when you’re not actively using them.
Your Android phone will let you do many things at once, even though all of them might not be on your screen. Besides system processes that can do things like checking your location or seeing if you have any new email, apps can be opened and then be left to run in the background while we are doing something else.
A good example would be when you open your favorite music player and cue up a playlist to listen to while you check out Facebook or do a little web browsing. The music app is running in the background, doing its thing while you’re looking at something else.
But some apps can be sent completely to the background. In our example of Android O’s Background execution limits, the music player is not on the screen and running as a background app, but it’s still interacting with us and playing music. Other apps that we’ve opened and switched away from should be treated differently because we’re not doing anything with them.
This can have an effect on the limited resources of your phone. Apps running can use RAM and take processing time away from other apps that need a turn or even the app you’re currently using in the foreground (what you see on your screen.) While Android has always had some restrictions on what an app can do while it’s not on your screen, Android O brings smarter limitations to help conserve system resources and battery life by determining when an app is really in the background and can be idle, then keeping it quiet but ready for when you want to use it again.
While this video is Android Nougat specific, it does a great job explaining how background services can affect the apps you’re actively using and ways to keep things in check.
What’s new or changed in Android O
- Background Service Limitations. The system now does a few routine checks to see if an app can be considered as being in the background. It checks to see that the app or any of the activities (things an app can do or initiate) aren’t visible on the screen. It then checks to see if another app is connected to it or uses any information from it, and finally, it checks for a few high-priority services like being able to act as a keyboard or if it is actively listening for voice input.
If none of these things are true the app is considered as running in the background. When an app is first considered to be in the background, it has a short window where it’s allowed to do its thing in case it needs to start something that would move it to a foreground app or service. Once that time is over the app is forced to be idle. Idle apps are also given short windows periodically in case they need to connect or start services, but other than those times it sits and uses very little resources until we switch back to it.
- Broadcast Limitations. Broadcasts are done by the system when specific events happen. When you switch your phone in and out of Airplane Mode, for example, a broadcast is sent to let apps know what happened. Developers can set up their apps to listen for specific broadcasts and write code so the apps do something when they happen. If an app is listening for broadcasts, every time one is sent the app uses system resources to see if any action is needed.
Apps built for Android O can no longer register to listen for broadcast messages that don’t directly target the app itself unless they are started and running (not in the background according to the rules above). These changes started with Android N, and changes in O are a bit more strict. Because this could limit what a developer might want to do, new tools to schedule specific jobs using their own apps processes have been developed. There are also a few broadcasts exempt from all of this, like when the time zone changes or the phone was plugged into the charger. Every app can listen for those, and react accordingly.
By limiting how an app can listen and what it can listen for, apps that have been designated as being in the background won’t wake up to see if they need to do anything as often. “Sleeping” apps use far fewer resources.
Why you’ll love it
We want our phones to do a lot of things. But no matter what we’re asking it to do, while we are looking at the screen we expect things to be smooth and responsive.
We’ve all felt the frustration that comes with keyboard lag once in a while, and it’s not a good experience. By keeping a tighter leash on the apps we’re not looking at, memory, processing power, and battery life is used more efficiently and we’ll see less of things like keyboard lag. The end user — that’s us! — doesn’t have to do anything here because these changes are part of the system. Even better, older apps that weren’t built with Android O in mind can be set to follow these rules from the apps setting page.
Changes like this get combined with the great hardware we see every year and mean your phone can do the things you ask of it even better!
Source: Android Central
PROBIT TECHNOLOGIES.COM Blog