Stop killing my iPhone battery

Last Update : January 19, 2017

One of the biggest complaints about the Apple mobile operating system iOS7 is how easily it drains your iPhone battery. Here are a few quick fixes to keep iOS 7 devices powered for much longer :

  • disable the Background App refresh (actualisation en arrière plan)
  • turn off Location Services completely or disable certain apps one by one
  • reduce the motion of the user interface in accessibility (set parameter to “on”)
  • disable the automatic updates option
  • turn off AirDrop
  • turn off all notifications for unnecessary apps
  • turn off unnecessary system services
  • disable Auto-Brightness and decrease the setting manually
  • disable what you don’t need in Apple’s internal search functionality called Spotlight
  • close open apps : you can can close multiple apps at once by double clicking the home button to reveal open webpages and platforms, then swipe up to three apps at the same time by using three fingers and dragging them upwards.

The following list provides links to additional informations about the iPhone battery power-saving options :

Fiddler : Web Debugging Proxy

Last update : May 22, 2015

Building web applications is hard work and most people remain unaware of how their web application is interacting with the web browsers that their clients have installed. Fiddler,  a free web debugging proxy created by Eric Lawrence, helps to simplify the analysis process substantially by logging all HTTP(S) traffic between your computer and the Internet. Fiddler is a transparent proxy that automatically adds itself to the WININET chain so that it can see every request being made. It logs those requests and the responses to allow you to see what is working and what isn’t working.

Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and “fiddle” with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language. Fiddler is freeware and can debug traffic from virtually any application, including Internet Explorer, Mozilla Firefox, Opera, and thousands more.

The developper, Eric Lawrence, was Security Program Manager at Microsoft for Internet Explorer. After over a decade of working on the web for Microsoft, Eric joined Telerik in October 2012 to enhance the Fiddler Web Debugger on a full-time basis. Telerik is devoted to making software development easier and more fun and has committed to keeping Fiddler free and expanding its value by further investing into the tool.

A quick summary of getting started with Fiddler has been published at Developer.com. A detailed documentation is available at the Fiddler website. A discussion forum and a developer section are available at the same site. Various addons and third-party extensions have been developped.

Fiddler can be configured to analyse the http traffic of iPad’s, iPhone’s and other web devices.

A simular tool called Charles is available for Mac Computers.

Some related tutorials about Fiddler and HTTP debugging are listed hereafter :

screen.width & screen.height for iOS devices

You can detect the screen dimensions of a web device via JavaScript by using screen.width and screen.height.

For an iPad one would think that screen.width would be 768 when being held vertically and 1024 when held horizontally. However, screen.width is always 768 regardless of the way you’re holding the iPad; likewise, screen.height is always 1024. The same is true for the iPhone/iPod Touch. screen.width is always 320 and screen.height is always 480.

The iOS devices support however the window.orientation property, so if necessary, you can use that to determine if the user is in horizontal or vertical mode.

  • window.orientation is 0 when being held vertically
  • window.orientation is 90 when rotated 90 degrees to the left (horizontal)
  • window.orientation is -90 when rotated 90 degrees to the right (horizontal)

There is also the orientationchange event that fires on the window object when the device is rotated.

The mediaquery “orientation” works also in current versions of Safari and Firefox on a desktop machine. Simply change the size of your browser window until the height is longer than the width and you get “portrait”.

Scroll content on the iPhone and iPad

To scroll content inside a fixed width-height element (e.g. div) on an iPhone or iPad, the user must use two fingers to scroll any area on a page that is not the entire page. One way to work around this ‘feature’ is to implement a touch event handler that moves the div up when the user touches it.

A better way to add one finger scrolling to divs on iPhone’s and iPad’s is the iScroll4 script developed by Matteo Spinelli. This script provides the following features :

  • Pinch / Zoom
  • Pull up/down to refresh
  • Improved speed and momentum
  • Snap to element
  • Customizable scrollbars

How to make an iPhone web app ?

Tetris web app for iPhone

An iPhone web application (web app) uses Web 2.0 technologies to deliver a focused solution that looks and behaves like a native iPhone application. iPhone web apps run in Safari on iPhone, the unique implementation of Safari that provides full-featured web browsing on iOS-based devices and responds to touch-based gestures.

The Apple Safari Developer / Reference Library provides guides, tutorials, code samples, FAQ’s  and best practices about the creation of web content for iOS devices. The Safari Web Content Guide, the HTML Reference, the CSS Reference and the JavaScript Guide are key documents.

A very useful tutorial about the creation of an off-line Tetris game for an iPhone has been published by Alex Kessinger on the Six Revisions Website. A tutorial about how to install a web app on iPhones has been written by jeshyr on the iTalk Magazine.

There are several tools and frameworks available to build html5/css3 web apps for iPhones or for other mobiles (cross-platforms). A list of a few ones is shown herafter :

  • iWebKit 5 : an outstanding kit with copy and paste elements designed by Christopher Plieger and Johan Van Wilsum to create iPhone web apps.
  • Appcelerator Titanium : an SDK for different application environments. The SDK provides the necessary tools, compilers and APIs for building for the target platform.
  • Sencha Touch : a free HTML5 mobile JavaScript framework that allows you to develop mobile web apps that look and feel native on iPhone and Android touchscreen devices.
  • PhoneGap : an open source development framework for building cross-platform mobile apps with support of core features in iPhone/iPod touch, iPad, Google Android, Palm, Symbian and Blackberry SDKs.
  • Corona : fast and easy development tool for iPhone, iPad and Android games and applications.
  • jQuery Mobile : Touch-Optimized Web Framework for Smartphones & Tablets.
  • iUI: iPhone User Interface Framework
  • Dashcode : part of Apples iPhone SDK

There are also tools and simulators to test created web apps :

  • Bugaboo : an App for debugging web apps on iPhone, iPad, and iPod touch devices, downloadable from the Apple App Store.
  • iPhone  simulator : web browser based simulator

You have to be aware that there are some differences between iPhone native Apps and web apps.

A native App runs code (Objective-C program) on the device and is installable through the App store (if approved by Apple). You have access to all the UI elements the iPhone uses and can do things like 3D which are impossible in the Safari browser. You need a mac to make a native App, but you can make web apps with any platform of your choice.

A web app is accessed via the Safari browser and requires no install. You are just going to a website that has a special stylesheet for the iPhone. Because a web app can also be installed on an iPhone with a custom icon, a custom startup screen, a native look-and-feel and can be used even when the phone is not connected to the Internet, the differences between Apps and web apps are becoming very small.

There are a lot of native Apps that could be run more efficient as web apps. And there are tools to convert a web app into a native App. Make your choice !

iWebKit, jQTouch and iUI

iWebKit is a file package designed to help you create your own iPhone, iPod Touch and iPad compatible website or webapp.

iWebKit has been specially made for Apple mobile devices. Specific iphone css and html rules compatible with safari’s engine called “webkit” are used. Most browsers won’t be able to open an iWebKit site correctly, currently only chrome and safari do on a desktop PC ( http://demo.iwebkit.net).

iUI and jQTouch are frameworks that include all the css, javascript and images needed to build native looking apps.

jQTouch is a jQuery library, it’s functionality is currently comparable to  jQuery UI.

Thoughts on Flash by Steve Jobs : go to HTML5

Recently, Steve Jobs published his thoughts on Flash on the Apple website.

Steve Jobs explains why Apple does not allow Flash on iPhones, iPods and iPads.

  1. open standards : Adobe’s Flash products are 100% proprietary
  2. full web : most videos are available in a modern format, H.264, and viewable on iPhones, iPods and iPads
  3. reliability, security and performance
  4. battery life
  5. touch : Flash was created for PCs and mice, not for mobile devices with touch interface
  6. Apple wants to provide the most advanced and innovative platform to the developers

Steve Jobs recommends to use the open standards HTML5, CSS and JavaScript for mobile devices.

One on the first to follow this idea is the developer of the JW video player, Jeroen Wijering. Even if he thinks that there is still a lot of work to be done before HTML5 reaches the maturity level that Flash has for delivering video content to the users, he released the beta version of the HTML5 JW player two weeks ago.