Our Insights Post 7 mins Arran Kirkup Reducing Your App’s Battery Drain The impact apps have on device battery life is increasingly an area which is likely to impact app development. Most users now are aware that apps running in the background can create significant battery drain with manually amending your phone settings and preventing apps from refreshing in the background being a process many users have gone through in the past to get the most out of their devices. With the increasing demands of larger screens, multi-core processors and higher resolution displays as well as diminishing returns in the miniaturisation of Lithium-Ion batteries Apple and Google are becoming less tolerant to apps running in the background and consuming resources. Battery Technology A lot of this comes down to the battery technology itself. All modern smartphones use either a traditional Lithium-Ion battery or the more recently introduced Lithium Polymer (or Li-Poly) battery. Both Lithium-Ion and Li-Poly batteries have the same chemical composition but the difference lies in their tendency to overheat. Because of this Lithium Ion batteries have an active protection circuit, essentially an onboard computer, that prevents the battery from overheating and potentially bursting into flame. Li-Poly batteries do not require this and can be found in sizes as small as that of a credit card. Lithium Ion batteries have a greater energy capacity than Li-Poly batteries so in devices that have higher current requirements Lithium Ion batteries are preferred. In devices where size is paramount Li-Poly is the choice. Lithium Ion batteries are also cheaper to manufacture so this tends to be the go to for lower cost devices. As the current Lithium-Ion and Li-Poly batteries show diminishing returns at far greater cost the attention of the research community has largely turned to Lithium-Sulphur. It offers a cheaper and more powerful alternative to lithium-ion, while avoiding the use of the costly and rare metal cobalt, but scientists have struggled to bring this solution to market due to an issue with the progressive leakage of active material from the cathode resulting in a low life cycle in the battery prototypes. Sony claim they have solved the problem and are hoping to ship the first consumer devices with Lithium-Sulphur batteries in 2020. It’s hoped that this should see increased battery capacity of around 40% compared to the equivalent Lithium-Ion batteries. What have manufacturers and platforms done to help? Naturally, with Lithium Ion batteries beginning to show the strain of powering modern mobile devices, there is a huge incentive for Apple, Google and third party manufacturers like Samsung to find solutions to help improve battery life. In fact in a 2019 survey by Morning Consult 95% of respondents declared battery life to be somewhat or very important when choosing their next phone. OLED Screens – Most high end smartphones now use OLED rather than LED screens. The key advantage of OLED over other screen technologies is that the organic diodes used emit their own light. This means that they only require an electrical current to work and don’t require a battery-hungry and space consuming backlight. OLED displays can light up individual pixels which leads to a reduction in energy consumption; especially when paired with the next feature. System Wide Dark Mode – Both iOS and Android have introduced OS level Dark Mode features. These not only reduce battery drain by presenting users with a consistently darker version of the operating system and it’s apps to take advantage of OLED screens but have also proven to be popular with users who cite better readability, less eye strain and lower levels of blue light. Processor Trickery – Apple’s real advantage over its competitors comes from owning their entire vertical stack: the software, the system hardware, and the chip design. This has allowed their newest A13 processors to perform surprisingly well against their competitors chips (despite fewer, smaller cores) and to manage battery levels more efficiently. They’ve done this by splitting their 6 cores into two high-intensity cores (codenamed lightning) and four low-intensity cores (codenamed thunder). For low-intensity tasks like reading emails or browsing simple web pages only the more efficient low intensity cores are used which keeps battery use low. However, when you open your camera app or begin performing any other high-intensity tasks the lightning cores kick in to handle it. It’s a typically elegant solution and is all optimised using machine learning to actively predict when you’re likely to require more heavy lifting to keep things as snappy as possible. Closing Down Apps – Both Apple and Google have begun to aggressively close down apps which are using more battery life in the background or alerting the user to battery intensive apps with an option to shut the app off entirely. While the exact criteria for shutting down background applications is not public; anecdotally both platforms will shut down high battery drain apps which are infrequently used. We know that Android at the very least uses what Google call “App Standby Buckets” to sort apps depending on the frequency of their use and assign resources based on this. What can you do to reduce your app's battery drain? Now that Apple and Google are aggressively closing down battery sapping apps it’s likely that you’ll want to make changes to your existing apps to avoid this and design your future apps with these learnings in mind. As well as making changes to your app to encourage users to actively use the app you can implement some of the following fixe to prevent your app from being shut down. Follow “Lazy First” Practices – Developers are beginning to take battery management into consideration far more and by following practices such as ‘Lazy First’,which involves reducing and optimising the battery-intensive operations of the app, you can save a great deal of unnecessary CPU or 4G/5G load. This can include caching data instead of re-downloading it and deferring certain actions such as backing up data to the cloud until the device is connected to a power source as well as starting high intensity functions only on first use rather than on app load. Use the Available Dark Mode Functions – Maximise the benefits of users’ swanky OLED screened devices to save their battery life and help your app minimise it’s footprint when the OS is looking to terminate rogue applications. Your app should recognise when a user is using Dark Mode and automatically switch to a dark theme. See our previous blog regarding Designing for Dark Mode for more information. Work with, not against, the OS tools to reduce battery drain – By optimising for Doze and Standby modes you can ensure that your apps functionality is not adversely affected by these. If a user leaves a device unplugged and stationary for a period of time with the screen off the device enters Doze mode. In Doze mode the system attempts to conserve battery by restricting apps’ access to network and CPU-intensive services. It also prevents apps from accessing the network and defers their jobs, syncs and standard alarms. Periodically, the system exits Doze for a brief time to let apps complete their deferred activities. During this maintenance window, the system runs all pending syncs, jobs, and alarms and lets apps access the network. For apps which need to run in real-time in the background this can be an issue. Monitor the Battery Level and Charging State and amend your apps usage accordingly – It seems a bit of a no-brainer doesn’t it? It’s frankly shocking how many apps will continue to attempt to run as normal when a device is getting low on battery. Both Operating Systems will allow more leeway when a device is fully charged or plugged in while closing down errant applications with almost reckless abandon when below the 20% threshold. The more you can do to operate according to the Battery Level and Charging State the more likely you can keep your app open for longer and protect it from having its core functions shut down. Analyse the Power Use of your Apps – You can use Battery Historian for Android or Instruments for iOS to log and monitor the battery usage of your app and spot problematic behaviours including CPU activity, network activity, changes in screen brightness etc. Identify the areas where usage is highest, and see if you can reduce impact in those areas. For example you might find opportunities to defer discretionary or network tasks until more energy efficient times; such as when the device is plugged in or on Wi-Fi. In Conclusion For years battery management has felt like somebody else’s problem when designing and building apps. But as users expect more features, lighter phones and a consistent one-day battery life the burden has fallen from the hardware manufacturers and platform providers to the app developers themselves. We’ve outlined a few simple ways above that you can manage this in your own apps but if this is something you’re struggling with it’s worth talking to an App focused agency like Indiespring regarding other reasons your app might be getting shut down or battery use is getting out of hand. It’s important that, on top of making the changes above, you also design your app with an eye on user behaviour in order to keep users actively engaged. Both iOS and Android will prioritise well used apps over rarely opened ones and it’s worth bearing in mind that the old idea of running an app constantly in the background just isn’t an option any more.