Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Ian_Thain
Developer Advocate
Developer Advocate

I read a article today "Out of power? Don't blame the battery, rap the app" http://www.computing.co.uk/ctg/news/2328837/out-of-power-don-t-blame-the-battery-rap-the-app and it made me think of a presentation I gave many years ago when I was evangelising Sybase PocketBuilder on the Windows Mobile 2003 platform.Even in those early days of mobile we would advise that care and skill was needed to develop for a small device with limited power, compared to a desktop app. An extra reason why we took the time to advise, was that for PocketBuilder, a lot of the early developers came from the Client/Server PowerBuilder product, that PK was evolved from.

Nowadays with Mobile App Development more mainstream, dare I say it leading, being aware of development practises are even more important! Mobile is now part of everyone's lives, not just the lucky minority as it was way back in the early days. For the Mobile developer there are now tools to help tune their code, but coding for Mobile they need to be aware of and follow some rules...

  1. Mobile devices don't have a swap space so use memory sparingly. Memory allocation takes power, so when objects etc are needed, free memory
  2. CPU usage uses power, so currently these devices aren't going to be used for number crunching etc, but don't poll the CPU constantly (use timer events wisely).
  3. Unnecessary animation uses power! Get the drift? 😉
  4. Write lean & mean code… OK simpler said than done sometimes, but bear in mind
  5. If you are not using radio resources, BlueTooth, WiFi, Cellular etc. then release handles, close connections etc
  6. When transmitting data connect only when needed and transmit small compact amounts of data. Radios will usually power down when not used
  7. If you are not using on device hardware such as the accelerometer or location services on an iOS device, disable event notification

Not all the blame can be on the app! What is interesting is that the users habits also will effect battery usage! Devices use less battery power when transmitting data via WiFi than cellular! So educating users to know that fact is beneficial, though making users aware that having both cellular and WiFi on at the same time will use more power is also a positive. Also for iOS turning off Location Services & Background App Refresh can help extend power levels.


Then on top of those, user power gotcha's is battery care and by that I mean the cardinal sin of overcharging the device (overnight) and not draining the battery maybe once a month and fully recharging, which is always a good habit to get into.


Both sides being aware, should ensure Power to the Mobile People!

Please follow me on Twitter @ithain