Multitasking & Battery Life

One thing that has annoyed me for the longest time now is this myth that multitasking somehow reduces battery life. The iPhone multitasks today, it just doesn’t allow multiple third party apps to run concurrently.

I’ve written a lot of software, both application and system level (right down to the lowest levels of an RTOS), and believe me, if it is written properly a background app does little or no harm to battery life.

Many of the applications that people would like to see running in the background would spend almost all of that time waiting for a system event. That waiting state doesn’t harm your battery life; only when the application is actually processing something does it really consume power. The push mechanism on the iPhone today might actually be worse since it has to load the app each time, a far more expensive operation (in CPU, and therefore battery) than just switching to one that is already “running.”

Consider the IM app example that is so often used to support the claim that background apps kill battery life. Sure, if you run the IM app (background or foreground) and stream messages at it continually, then it will reduce the battery life. If you just have it sitting there in case somebody tries to start a session though it isn’t doing anything most of the time (occasional presence messages perhaps). I ran an IM app all the time on my Nokia N95, connected over AT&T’s network 24/7. My battery life was unaffected, as expected.

Another example of a well behaved background app is the daemon that we wrote for the jailbroken version of Devicescape’s app (before the SDK and app store existed). It made no difference to battery life because it spent almost all the time blocked waiting for a system event. One that only happened when a new Wi-Fi connection was made. We run in the background on Nokia, Windows Mobile and Android (not to mention Windows XP/Vista/7 and Mac OS X) today without impacting battery life.

So what will affect battery life? Well, an app that continues to do something in the background, rather than waiting for an event, one that polls for an event rather than blocking until the OS tells it about the event, or one that requires a power-hungry piece of the hardware to be on all the time (e.g. GPS). But even those apps have their place. Imagine a background image uploader: it will do something in the background while it is needed, and then exit or wait for a new photo to be taken. Or an app that checks your location every 5 minutes. It is my choice to use the battery that way, so why restrict it? Just make sure it is reasonable for the application, explained to the user, and under my control (can be checked as part of the review process).

These types of apps don’t take any more power than they would if I left them running in the foreground, but letting me push them to the background allows me to choose if I want to watch them work, or read my email etc.

Above all, please stop spreading this myth that multitasking or background processes will harm battery life. Only badly written apps would do that.

Nokia Should Switch to Mac OS X

A little different from my recent posts, but this is something I’ve been thinking about for a few weeks now believe it or not. Nokia should switch to Mac OS X.

OK, I don’t mean they should switch their phones over to running Mac OS X, nor for that matter even their new netbooks. I mean they should switch their application development environment from Windows to Mac OS X.

Why?

Aside from it simply being a much, much better platform to use for development in general, it is also the platform that a large number of mobile application developers already use. Over 125,000 registered mobile app developers out there today are using the Mac platform to write apps for the iPhone platform. The majority of those developers are not going to think of switching to a Windows box to develop on. If Nokia wants to court some of them into developing for its smartphones too, it needs to have a development environment that runs under Mac OS X.

XCode or Eclipse

It doesn’t matter as much as the platform choice, but plugging into XCode as well would certainly make the process more familiar to iPhone developers.

What really matters though is that the tools are simple to install, run smoothly and allow for rapid development (including simple, fully operational device debugging).

Nokia’s tools people need to spend a few days working with the iPhone SDK and getting a feel for how smooth the development process is. (OK, I know the certificate stuff isn’t great, but it is still integrated into the build process, and the newer releases of XCode have made it a little easier to deal with.) Then make sure the Nokia platform is as simple to use, no matter what tools it is based on. This is about a complete system.

S60 or Maemo

While we’re talking about cleaning things up, S60 has gone beyond its useful life. I used an N95 for two years from when they first came out, and believe me that was already stretching S60 beyond breaking point. The newer phones are being seriously let down by S60.

If Nokia could just accept that Symbian is dead, and move their vast momentum behind Maemo, a platform they’ve been developing and proving in the field for several years now, but still don’t have the courage to stand behind 100%, they’d actually have a platform that could compete with Android for sure, and perhaps even Apple.

There are some simple rules for success here though (and something that Android is already failing on):

  • Own your platform. Define it, and keep it consistent. You can mix up the peripherals a little, but keep the screen size the same, and make sure the OS abstracts the interface to things like keyboards so no matter what the hardware supports, the apps don’t need to change.
  • Simple, clean UI. Given where we are now, it is going to be a touch screen interface, so design it as such. Don’t worry about the existing S60 apps – they’re history. Make it clean and simple for all the exciting new apps.
  • Powerful APIs.Let me use things like the network, the location services and the maps without having to jump through hoops, several times, with my hands tied behind my back.
  • Single API.While the APIs need to let me access the full power of the device (and this is the iPhone’s achilles heal), there should also be just one API for each function. KISS matters.

A clean, standard, C++ API based on the Trolltech technologies, and a solid, secure OS like Linux would make a very solid platform.

What About the S60 Apps?

What about them? The folks developing apps for the S60 are going to move on. They’ve probably already moved on – to iPhone or Android. The rest will happily follow.

This idea that you can’t disturb the value chain is nonsense. Even the name implies that: it is a chain, attached to a leader. Where the leader goes, the chain follows. It is how they make money. And realistically what are the alternatives? They’re going to have to change platform regardless, why change more than you need to.

Stimulus

Perhaps this quarter’s massive losses at Nokia will be enough to shock them into activity. The saddest part of all of this is that they have been sitting on the answer to many of the issues with their smartphone platform since before the iPhone and Android were even players in the space. Ironically, they’re also the one company that should feel completely comfortable backing a Linux solution: it is, after all, a Finnish OS.

If, even after all these years with Maemo, FOSS issue is a problem though, how about using NetBSD or licensing a true microkernel like QNX Neutrino? Trolltech’s UI would run on both of those very easily (one of my last demo projects at Wind River was to port the open source version of Trolltech’s code to run under VxWorks AE – it was a simple port, and ran very well).

The Price of Abstraction

Jason Kester has a very insightful post up on his blog this weekend about the use of the terms “magic” and “smart” to describe software tools & frameworks. And more importantly perhaps, about the features themselves, which are often anything but “magic” or “smart.”

The problem is that these features hide the real operations that are going on under the hood. It makes what are potentially complex, time-consuming and performance killing operations seem like a simple thing. They also make it next to impossible to work out when that is the case and when it isn’t. Since I’ve been looking at Ruby on Rails a little at the moment (it seems to be the most popular choice of web development language at the moment), I was interested to see Rails being listed there as well.

In my past I have seen similar problems with C++ (unexpected calls to copy constructors and conversion operators) and had to create coding standards that helped to catch these sorts of problems at compilation time rather than letting them get into executing code where it becomes next to impossible to track them down. That’s harder to do with things like Hibernate where the problem is caused by the abstraction itself, and it not just a symptom of powerful language features.

Apple’s Vista Ad and More…

One of the most annoying things about the early versions of Vista that I was playing with was the continual darkening of the screen and question about whether to allow something I had just asked for. That is what this commercial from Apple is playing off of. Perhaps the worst example of this was having to allow notepad to open each time I wanted to view the source for a web page from IE7. Apart from the fact that by now they should be able to open it inside the browser and display it with syntax highlighting like every other browser, having to approve it every time is really annoying.

Continue reading

Devicescape @ Demo 2007

For those that haven’t already seen it, the 6 minute presentation that Devicescape gave at this year’s Demo conference in Palm Desert is up on YouTube. I’ve embedded it here for your viewing pleasure too.

You can learn a little about Devicescape‘s hotspot login solution, and see some of the website too, but since it is free, why not just go there, download the software and try it?

Roaming San Francisco

Crepe House (Post)I spent Thursday roaming around downtown San Francisco going from one wireless hotspot to the next testing some new features that we’re adding to Devicescape‘s hotspot login service.

I got off the ferry from Alameda just after 8:40am at the ferry building and walked up Market Street (in the rain). First stop was a Starbucks to get my email and do a quick test of a new, faster way to connect to T-Mobile hotspots.

Continue reading

Join The Devicescape Beta

So here is what I’ve been working on for past few months… a service that helps you login at wireless hotspots. What is the big deal there you ask? Well, from your laptop it is only a small inconvenience to jump through a hotspot’s sign-on page, but on a phone like the Linksys WIP300 it is impossible normally since the phone doesn’t include a web browser.

With Devicescape’s firmware in the phone, you can walk into a hotspot (currently a US T-Mobile location, any FON hotspot worldwide or Google’s Mountain View municipal network, with more to follow soon), switch on and start making calls using your Gizmo or other SIP account.

Want to try it? Sign up at http://www.devicescape.com/, download the software for your device (currently supported: Windows XP, Windows Mobile 5, the Linksys WIP300 and the Nokia 770 web tablet), enter your account info and roam around town. Remember, it’s a beta so if you encounter problems be sure to let us know and we’ll try to fix it.

Broken Windoze

Ooops...Seen a lot of in-store equipment recently that has crashed and is either in the state shown in this photo where Windoze is trying to reboot and failing, or it is stuck trying to install/upgrade something.

Seems that people still haven’t learnt not to rely on Windows for something that needs to keep running, although in the case of the Dell console at Costco I guess they could be forgiven there since they’re selling Windows boxes. Hope the ones they sell keep running better than the console though 🙂

Digital Rights Management

In an article titled Music lovers caught in DRM battle, on the BBC News web site there is a quote from one Brad Duea, the president of Napster, where he states:

So we try not to view the DRM as something that limits consumers but instead enables them now to take all their music on the go.

I don’t know where he’s been living, but the last time I checked my legally purchased (on CDs), but non-DRM’d music worked just fine in my portable music player (an iPod). I don’t see how adding DRM would enable me to do anything more with that music than I do today. I can see how it would let me do less…

Now, as someone who works with intellectual property (both as a software engineer and as an amateur photographer), I do not agree with people using IP without permission (a license). There are a few problems with DRM technology though:

  1. When the licenses become more restrictive (as many software licenses are today), then people will find ways around them. If music becomes as restrictive as software, which it would seem the DRM technologies are moving in the direction of, then more people will circumvent them and piracy will increase, not decrease.
  2. DRM technologies will only restrict what honest paying customers can do; those intent on pirating the music will always be able to get around the DRM.
  3. Having multiple DRM technologies, and multiple audio formats will mean that consumers will be forced to stay with one hardware vendor. If my iPod breaks, I have to get another one because nothing else will play the songs I buy from iTunes. Or I can pay for the music again in a different format.

The current situation is not good for anybody. There will always be people who copy music (and software, and photos and other forms of intellectual property). Some of the recipients of those copies might actually like what they hear and buy it, or buy other things from the same artist. Remember the music industry hated radio and the cassette tape when they appeared, but long term I would say they have been good for business (and we won’t even get into the movie industry and the VCR). Sharing music is a form of promotion. The majority of the people who don’t buy more music having heard some for free, wouldn’t have bought it anyway. Either they didn’t like it, or they couldn’t have afforded it in the first place.

If the music industry was feeling brave, they might like to try something like the shareware software scheme: they could make some of their music available, unprotected and in MP3 format, perhaps at a lower bit rate than most people would use. This has a couple of key advantages:

  1. It acts as a great promotional tool (try before you buy always works well with IP). Consider this to be radio for the iPod generation.
  2. It reduces the need to pirate the songs since they are available legitimately for free, thereby taking some of the pirate’s market away.

Perhaps software like iTunes and WMP could read a tag from these unprotected tracks and display an upgrade button in their library browsers. Press the button to buy a higher quality version of the track, or a different version of the track. Buy enough and you get bonus tracks; or buy five upgrades, get five upgrades for free; or whatever – the possibilities here are endless, if only the industry has the guts to take a chance on it rather than circling the wagons and trying to annoy their most loyal customers in an effort to prevent people who were never their customers from doing what they’ve always done, and will continue to do regardless.

Of course, they’ll never do it as it would be too radical a move for what is at times an oddly conservative industry. Unless one of them does it… Sony: you’ve been bitten by DRM, how about it? How about trying something different, and a little revolutionary?

Gizmo Update

Gizmo ProjectI have been using the Gizmo Project client on my Mac for several weeks now and mostly I am impressed. I did get a Plantronics DSP500 USB headset which is both comfortable and clear. That made a big difference compared to using just headphones and the built-in microphone (using both built-in microphone and speakers is a bad idea – too much echo for the person on the other end of the line who gets to hear everything they say repeated back on the line).

Mostly, I have been making trans-atlantic calls with it and have found it to be very stable for a beta release. There have been a couple of updates (including one that restored the ability to record calls on the Mac). The only real problem I have had is with their ecommerce backend. It has been down a couple of times now so the client believes that you have no credit and won’t let you make call-out calls (i.e. calls to the PSTN). It also won’t let me buy $20 of credit at the moment. Couple that with the fact that during the beta you can only buy one block of time each week, and it could be annoying, but in fact the $10 lasted over two weeks.

I am also working with VoIP at work at the moment – porting the open source VoIP PBX software Asterisk to run on one of our wireless access points. You can read all about this work on the Devicescape blog, including a mini-review of a Wi-Fi VoIP handset from ZyXEL.