SIDEBAR
»
S
I
D
E
B
A
R
«
The iPhone Has Blinders On
March 21st, 2008 by jens

I bow to my esteemed colleague Craig Hockenberry’s greater experience in iPhone development; but I must disagree with his take on the infeasibility of background applications. He gives two reasons why networked apps shouldn’t run in the background — one technical and one user-interface.

Battery life.

The heart of the problem are the radios. Both the EDGE and Wi-Fi transceivers have significant power requirements. Whenever that hardware is on, your battery life is going to suck. My 5 minute refresh kept the hardware on and used up a lot of precious power. *

My immediate response is that, yes, polling is inefficient. Everybody knows this; but it’s also easy to implement, which is why way too many protocols use it. Normally the problems with polling first manifest as scalability problems on the server (as Twitter quickly discovered), but in the case of mobile devices, polling kills battery life.

So it’s a good thing that none of the real instant-messaging services poll. AIM, Jabber, MSN, Yahoo and ICQ all open a socket at login and leave it open, sending data only when necessary. If you suppress buddy-list updates while the app isn’t active, then data only needs to be sent when you send or receive an IM.

The remaining issue is one I don’t have the technical knowledge to answer: how much less power does it take to leave the EDGE radio passively listening for packets, as opposed to sending them? (Anyone who knows, please comment.)

One possibility is that it’s the same standby state the radio is already in (since obviously it has to be listening for incoming cellphone calls and SMS messages), so it incurs no extra battery drain. That would make non-polling background network services like IM clients totally feasible.

The other possibility, though, is that even listening for EDGE IP packets uses a lot of power. Which would be bad news, as it makes any background notifications other than phone calls and SMS impractical. But I don’t really believe this is the case — because if it were, how would the iPhone’s upcoming “push email” support for Microsoft Exchange work?

(Moreover, I have to point out that my prior cellphone, the T-Mobile Sidekick, had excellent AIM support, as well as push email, from day one, so it clearly is possible. The Sidekick’s battery life was decent, with maybe 3/4 the standby time of my iPhone.)

User-interface clutter.

From Craig’s second post:

You now have five independent sources for notifications. How do you let the user know which one is which? One might say, “make the sound different.” Another might say, “make something flash in the status bar.” Someone else might say, “make the phone vibrate.” Or even, “put up an alert box.” A truly sick individual might say, “Do all four.”
Can you see where I’m going with this? Your phone soon becomes a fricken’ pinball machine as multiple applications fight for your attention. With 24 notification permutations for every application, things will quickly get out of hand. *

I don’t buy this at all. In fact, I think it’s paternalistic. Yes, user interface design has to consider unintended consequences of users’ own actions, but this is a situation where the consequences are entirely obvious to the user: the more notifications you turn on, the more distractions you’ll get. The remedy is just as obvious: if you end up with too many distractions, you turn some of them down or off by using the exact same steps you used to turn them on in the first place.

I don’t mean to put words in Craig’s mouth, but I think that between the lines, that quote says: “You’d be able to turn on so many notifications that I would find it intolerable.” He’s dismissing a huge swath of functionality because it could be overused in ways that he personally would not want on his phone. That’s not a valid argument.

[It is, however, the kind of thing that’s already gone on with Apple’s own iPhone apps. My pet peeve is that the calendar’s alarm cannot be customized. It’s hardwired to emit two pathetic little bleeps, and that’s all, whereas phone ringtones are customizable and repeat. Clearly this was designed by and for people who have no problem remembering to attend meetings, and never procrastinate appointments, but will drop everything to answer the phone. Unfortunately I am completely the other way around, and I’m sure I’m not the only one.]

There’s also considerable irony here, in the fact that Craig’s best-known application is a client for Twitter, the service that is today’s poster child for “constant annoying notifications”. Clearly, then, he finds Twitter’s level of intrusiveness tolerable, whereas I generally don’t (I have an account but almost never use it.) On the other hand, I do find instant messaging invaluable, and mourn the loss of the mobile AIM presence I used to have on my Sidekick. Not that I got a lot of IMs while away from the computer; but the ones I did get, or sent, were often important to me. Chacun a son gout.

Gloomy conclusions.

I’ll end this with two spot-on quotes. First, from developer Hank Williams:

Prohibiting background processing is not just a question of one feature being left off a long list of otherwise very well executed features. The issue of background processing is the issue for a mobile device because it is key to two things:
• telling the world about your status in some ongoing way
• receiving notification of important events
These two things are the key to most new real innovations in the mobile space.

And c|net’s Tom Krazit’s response:

That makes sense; remember that friend or relative who got a mobile phone but never turned it on? That practice greatly diminishes (although some might say it enhances) the value of a mobile communications device, and one-way communication is not what has made the Web so interesting in its second decade.

Bingo. I’ve been obsessed with what we now call “social software” for over a decade; and the iPhone SDK doesn’t give us the full functionality we need to do this kind of stuff. Basically, the iPhone has blinders on, like a cart-horse: if it’s not already looking at you (in your online manifestation) it can’t see you, and you can’t get its attention. That’s great for a cart-horse, but it’s death for any kind of social interaction.

As I said above, I am aware of the technical issues (and would like to understand the details better). There may need to be work done to allow multiple applications to receive background notifications, in a practical manner. For all we know, Apple may already be working on this. But of course we have no way of knowing, because, in typical Apple fashion, they will absolutely refuse to admit the existence of the problem, much less any efforts to work around it, until they have a complete solution to spring on us. Unless of course they just don’t care; entirely likely, since quite a lot of people upstairs at Apple don’t seem to ‘get’ social software at all. We just have no way of knowing…


32 Responses  
  • Jeff LaMarche writes:
    March 21st, 200811:23 AMat

    Bingo! Well said, Jens.

    I love reading Craig’s postings - they are always informative and interesting, but his posts on this topic have been a little bit abrasive for my tastes and seem to talk down to other developers probably more than he intended to.

    The assumptions inherent in his position, and Apple’s, for that matter is 1) that developers will not do thorough real-world tests on our applications to identify the consequences of using our creations, and 2) that because nobody has yet figured a way to do common background polling without killing the battery performance, that nobody ever will be able to figure it out. Otherwise, we would be at least allowed to try with the SDK. (You can, of course, try by jailbreaking your phone, but then you’re limiting your audience to people who have done likewise with their phone)

  • Craig Hockenberry writes:
    March 21st, 200811:42 AMat

    I never said that background applications were infeasible. I was merely stating that doing them isn’t as trivial as most have assumed.

    Polling is a fact of life with REST-based API. Sure, someday XMPP will be available for Twitter, but until that day, I have no option but to poll. The same is true for a lot of other interesting web-based APIs.

    From what I can tell, the majority of the power usage is from the Wi-Fi transceiver, not the EDGE network. Determining which radio is actually in use isn’t an easy thing to figure out at present (requires digging around with sysctl() or the SystemConfiguration framework.) Expect Apple to make this simpler in the future.

    As far as interface clutter is concerned, I think there need to be some controls put in place before it’s opened to all. If this is paternalistic, then so be it, because there needs to be a central place where a user can control how they are interrupted. Some users will want to be notified about Twitter, others will not.

    I think all these issues will eventually be resolved. But I don’t think it’s a failing on Apple’s part to not have everything in version 1.0. Remember that there was a time before Switcher.

  • punkassjim (LJ) writes:
    March 21st, 200812:01 PMat

    I’m glad to hear some dissenting opinions surfacing. I respect Gruber and Hockenberry, and I do believe Apple’s cautious plans are a good way to keep cruft out. But I also really think a huge amount of creativity is getting squashed.

    I think, in terms of user notifications, the developers will highly benefit from some form of plan for beta testing. Best way to get feedback for things like that. “Your popup is annoying/useless. Just play a chime and put a ‘message waiting dot’ on your app’s icon.” Further, it also makes the case for try-before-you-buy downloads, but I’m not holding my breath that the AppStore will have that.

    It seems AIM (and twitter, same story) has become the poster-child for background processes, but in my mind that particular nut seems one of the easier ones to crack, plus the fact that it’s essentially stifled in only one way. I’d imagine, if the developer community were to elect a new poster child, say MobileScrobbler (a native Last.fm client for iPhone), they’d get a much wider view of things. From the experiment that is jailbroken iPhone development, this app stands alone as a proper bundle of lessons learned. Preferences are centralized into the system, scrobbling can be queued while you’re using EDGE, and on and on. Plus, in terms of battery usage, it’s a very good example of an app that’ll shorten your battery time…but you kinda smack your forehead and say “well yeah, I’m kinda streaming music from the internet, duh.” It’s a damn good trade-off.

    But even forgetting the streaming for a minute, MobileScrobbler also acts as an extension to the built-in iPod app. When you’re playing music internally, you can switch to MobileScrobbler to check the band’s wiki page, see if they’re on tour, add a show to your calendar, read the lyrics, etc. Again, it’s gonna poll the server each time you run the app, so you’re likely to use more battery if you’re messing with it a lot…but that’s to be expected. But it’s also polling the iPod app. The thing is, none of these features would be possible with today’s SDK, or even with the limited improvements that most developers are begging for.

    [disclaimer: I’m not affiliated, I just like the app, and will be supremely disappointed if I’m unable to buy it (and others like it) on the AppStore]

  • Jens Alfke writes:
    March 21st, 200812:34 PMat

    Craig — Agreed that doing background apps isn’t trivial. But it isn’t rocket science (your idea of letting background agents run briefly once in a while so they poll at the same time is a good one.) I think it’s much more important than some of the stuff that has been exposed in the API, like access to the accelerometer, or even CoreLocation … so I think some priorities have been misplaced at Apple.

    For low-bandwidth polling, it might be better to preferentially use EDGE whenever it’s available, instead of Wi-Fi, if the power drain is less. I imagine that’s possible, by detecting which network interface is EDGE, and then binding sockets to that address before connecting.

    “There needs to be a central place where a user can control how they are interrupted” — that would be Preferences.app, right? All apps’ preferences will appear in there. You still need to choose the app before getting to its settings, but presumably you already know which app it is that’s bothering you.

  • Paul Handly writes:
    March 21st, 200812:48 PMat

    If I remember correctly, ActiveSync on other platforms does “push” by sending a special SMS message to the phone, which piggypacks onto the normal Cell network poll/health checking stuff. The ActiveSync client uses the SMS as a wake-up call to download the newly available stuff.

    I’d be more interested in how the Yahoo “push” IMAP works, and what (if anything) it implements beyond IMAP IDLE support…

  • pierce Wetter writes:
    March 21st, 20081:58 PMat

    I lived on EDGE for a year+ as my main Internet connection. So while I don’t know the precise details of how the radio works, I have a wealth of observation about what happens.

    Sorry Jens, but effectively, EDGE works like a dialup modem. Remember those? What happens on the iPhone when you pull up a web page from a cold start is that the radio talks to the cell tower, spends about 10 seconds negotiating a data connection (imagine those modem dialup sounds now) and then holds 4 channels open to the cell tower. It then leaves it open for some period of time.

    You can test this right now with your iPhone. Turn off WiFi. Bring up a web page. Time that.

    Bring up the same web page. Notice how its faster? It’s faster because the first page you bring up on EDGE is always slower then the second page.

    Simple really:

    Time to bring up first page = (size of page/240Kb/s + dial in time)
    Time to bring up second page = (size of page/240Kb/s)

    In other words, if you have a socket open to something, even if no data goes back and forth, its as if you were talking on your cell phone ALL THE TIME.

    There’s an alternative though, a push mechanism via SMS.

    I go into more detail here: http://www.opinionatedbastard.com/archives/iphone_push_api.html

    Sure, it would incur cost. So you wouldn’t want to use it for something overly chatty (like say, Twitter).

    But you don’t want your phone waking up every 30 seconds anyways. Hell, just with email I noticed that my battery life sucked if I had it checking every 5 minutes.

  • fluffy writes:
    March 21st, 20082:07 PMat

    SMS push is basically what the Amazon Kindle does as well (although it’s on CDMA rather than EDGE). When there’s new content available for the Kindle, a network-level message gets sent to it, which wakes it up and starts the download.

  • pierce Wetter writes:
    March 21st, 20082:56 PMat

    Yeah, why reinvent the wheel?

    Speaking of which, there’s some stuff in the public SDK about registering for URL protocol handlers. I wonder if SMS -> URL -> App would be a good way to do push?

    Hey Jens, is there anything in XMPP/Jabber that might work? Like XMPP over SMS?

  • Jonathan Wight writes:
    March 21st, 20085:10 PMat

    Well said Jens, was hoping to see someone rebut Craigs post.

    Craig:, “Comet” is an HTTP “push” technology that we’re beginning to see on Web 2.0 AJAX sites. It works basically the same way you describe, opens a socket, keeps it open, waits for an HTTP request, etc. Twitter may not be using it yet (they should though, they have performance problems already) but to say “Polling is a fact of life with REST-based API.” is just nonsense.

  • Soft Arts » Blog Archive » On the web: “The iPhone Has Blinders On” writes:
    March 21st, 20085:16 PMat

    […] I could not have said this better myself. […]

  • Alexander Griekspoor writes:
    March 21st, 20087:00 PMat

    I think it’s much more important than some of the stuff that has been exposed in the API, like access to the accelerometer

    I understand that your favorite feature may not (yet) be in the SDK, but this I strongly disagree with. Have a look at the introduction of the SDK and the games that were demo-ed there. I think those will have a much bigger impact than any twitterific like app (with all due respect) will ever have! Just have a look at this movie and think again: http://www.youtube.com/watch?v=hy0ptZisr70

    Anyway, it seems most people forget that what Apple is actually giving us is more than we had ever expected. Look at Craig’s and John’s earlier posts for some examples of that (what no IB? it will be there). Does it contain everything we want in June, of course not. I would like to see direct access to my iPhone from my Mac because I don’t want to sync 5Gb of PDFs over Wifi. Everyone wants there stuff (heck, these guys of rogue amoeba want root access because they want to do streaming audio etc).

    But please guys, instead of always complaining, give Apple some credit and file your bug reports. Craig is right, there was a time before Switcher.

  • Jeff LaMarche writes:
    March 21st, 20087:15 PMat

    Hey, Alexander? You know, I agree with some of your points, disagree with others, and that’s as it should be. There’s no need to tell people they shouldn’t express valid opinions. I think everyone here gives Apple quite a lot of credit.

    We’re just arguing the merits of a decision that Apple has made and which impacts our daily personal and professional lifes; there are no Apple haters here. Personally, I HAVE opened bugs for those things I perceive to be errors or serious omissions in the iPhone SDK (plus actual bugs to boot), and I’d guess other people posting here have also. That doesn’t mean we should close the book and stop thinking about those issues. Bug reports aren’t confessions that absolve us of responsibility or interest.

    Apple wants our opinions - perhaps not from each of us individually, but they do want to know when a lot of people are disappointed or upset with their offerings. Craig and Gruber have offered counterpoints to arguments made by many people (including me) - valid ones, that have caused me to re-assess, but not completely reverse, my opinion on this matter. This is called discourse and it is valuable. I don’t see how this discussion could be perceived as being, in any way, negative, even if some of us have strong opinions or sometimes don’t give very much thought to how others may perceive what we say.

  • Adam Bray writes:
    March 21st, 20087:20 PMat

    While I’m not certain on this, I can think of one possible technical issue with leaving a socket open in EDGE. When there is an active data connection on EDGE, calls can’t come through, they go straight to voicemail. The question is whether this happens only when you are actively sending data, or just when you have a socket open at all.

    I know with an old Windows Mobile phone, if I was doing streaming radio over EDGE, I’d never get calls. This is one of the big advantages of 3G, simultaneous data + voice.

  • Kordan writes:
    March 21st, 20087:25 PMat

    You also have to remember that most, if not all, of these App’s will need to be written so that they are feasible on both the Touch and the iPhone. The Touch does not have Edge, so a background polling App is not going to work at all on the Touch unless there is an active WiFi connection. If the WiFi transceiver uses the most power, and there is no other option on the Touch, it’s going to take an extra hit on battery life.

    Touch compatibility, I am assuming any App will have to work on both, is something that no one here is talking about.

  • Alexander Griekspoor writes:
    March 21st, 20087:26 PMat

    There’s no need to tell people they shouldn’t express valid opinions.

    Hi Jeff, I never had that intention, I just wanted to give a different sound then I have been hearing in many of the discussions recently.

    I don’t mind (and actually enjoy) reading the discussions about pro/cons of background apps for instance, but quite frankly probably only Apple knows the real agenda here, which is very likely both a political and technical one. And as the discussions become more heated the pressure seems often to shift from what very cool stuff we can actually now do (like accelerometer controlled games) to what we can’t (e.g. get root access or polling webservices in the background). Again, my point was only to bring back focus a bit on the first.

    As an (very) aside, perhaps it was a bit unfair to focus so much on Jens’ post, unfortunately both Craig and John G. don’t allow any public comments on their (often nice but quite opinionated) write-ups, a shame I think.

  • Joe Realist writes:
    March 21st, 20087:35 PMat

    Folks are arguing about background apps as hypothetical, when there are existing 3rd party background apps running now.

    There is already a fantastic 3rd party iPhone/iPod touch application that runs in the background, interacts with the iPod function, and never causes trouble. What is this app? MobileScrobbler.

    http://dev.c99.org/MobileScrobbler/

    Another one I run is OpenSSH. Some of you may have heard of it. I get 4 days of battery life from my iPhone that runs MobileScrobbler and OpenSSH in the background at all times.

  • Jeff LaMarche writes:
    March 21st, 20087:36 PMat

    As an (very) aside, perhaps it was a bit unfair to focus so much on Jens’ post, unfortunately both Craig and John G. don’t allow any public comments on their (often nice but quite opinionated) write-ups, a shame I think.

    Yes, I have been thwarted from many a knee-jerk response by their lack of blog comments. I understand why they do do it, though. They can both be abrasive at times and neither is afraid to express their real, unedited, opinion, tact be damned, and I’m sure they would get flooded with endless flames and trolls.

    One thing that I honestly find refreshing about the Mac developer community is that people are pretty thick-skinned and don’t get too offended when someone disagrees with them, even loudly or crassly :) Sort of reminds me of Usenet in the old days where people would get into huge heated arguments over trivial stuff (emacs vs. vi) but nobody got too upset and it was all in good fun. We (Americans at least) have become way to damn sensitive, if you ask me.

    As to your comments about people’s focus, I think we all argue from what we know and what we want. I’m not about to waste my time arguing a point I believe in but that doesn’t have any impact on my day-to-day life. Selfish of me, perhaps, but that’s the way I am, and I suspect I’m not unique, no matter what my Mom and parole officer used to tell me. ;)

  • barry writes:
    March 21st, 20087:40 PMat

    I’ve developed mobile apps for a number of years, and it is a completely different landscape.

    You can’t just extend the architecture of the internet and even worse the web to cell phones. All of the great background apps on Blackberries and Sidekicks and other push capable mobile apps use WAP push.

    WAP is huge protocol suite that was designed back in 90’s to make the internet kind of work on mobile handsets. It is a lot bigger than just WML which I think most people associate it with.

    WAP push uses special GSM short messages (one of the many variants, normal “text” messages being another). These are super efficient as short message protocol was designed with radio layer of GSM and messages fit exactly in a control time slot that would be used anyway. Voice calls use bigger data time slots that obviously use up much more energy. I’m not exactly sure of the specifics of EDGE, but I believe it is contained in multiple data time slots, but I do know that even listening for packets is expensive (though not nearly so much as sending).

    MMS (or “picture”) messages are also implemented using WAP pushes. At a high level, a push short message containing a URL is sent to the phone, then phone then fires up a data connection and uses HTTP to download the real picture message (which is XML based).

    So this seems easy, why not open it up to everyone? Well, WAP push protocols use gateway servers to do the heavy lifting (and to send the messages). Unfortunately, there is no Apache equivalent, and even if there was, you would still need to get direct access to the providers cell network in order to send the push messages (because clearly we don’t want clutter up users SMS inboxes and yeah Apple could make a hack such that a special flag marked an SMS as a push message, but that isn’t good for anyone).

    The question is then how to make this work well when many third party developers enter the mix. I would like to believe that Apple is working on this, but regardless it is stupid to say that it is an easy fix for anyone. It’s quite complicated.

    In addition, I’m sure Apple is privy to AT&T’s network roadmap, so it could also be that they know future network changes will clean up this whole mess. Keep in mind that EDGE (and to a lesser degree any kind of data connection over GSM) is a complete hack at the network level. Changing network infrastructure is expensive, so they did the best they could with what was already out there, but it is no where as efficient or high performing as it could be. (Just look at how much better data works over CDMA. But before you complain that the iPhone isn’t on Verizon, remember, Qualcomm is the Microsoft of the cellular world. GSM/UTMS is closest thing to “internet standards”). I’m not familiar with the details of WCDMA, but I would expect that it cleans up many of the problems, especially once AT&T actually fully converts it’s network (another reason why lack of WCDMA iPhone wasn’t a big deal - AT&T didn’t even have 3G coverage most places until the very end of the year, and throughput still isn’t much better than EDGE in most places).

  • Jeff LaMarche writes:
    March 21st, 20087:40 PMat

    Another one I run is OpenSSH. Some of you may have heard of it. I get 4 days of battery life from my iPhone that runs MobileScrobbler and OpenSSH in the background at all times.

    And we’ve also heard from people who have first hand experience writing similar apps that have sucked the batteries all to hell (aka Craig).

    But what we’re arguing whether it can be done, but whether Apple should allow it to be done. It’s not a simple issue, and I think those arguments aren’t much impacted by the fact that there are two existing apps that do some kind of background processing without noticeable impact. especially since the floodgates haven’t been opened - even people who have hacked their iPhones rarely have more than two or three non-Apple apps running. Once the app store opens, people could literally have dozens of apps on their iPhone, a machine that doesn’t swap volatile memory to disk and has only 128 megs of RAM. If half of those apps use up memory for background processing, it could be a problem.

  • Joe Realist writes:
    March 21st, 20088:04 PMat

    @Jeff LaMarche
    MobileScrobbler not only runs in the background and interacts gracefully with the iPod software without affecting battery life, it is perhaps the most seamlessly elegant mobile app ever created. It glues together the fantastic technologies of iPod, cell phone, and social networking absolutely fabulously. Yet, it is impossible to run for the non-hacker elite solely because of Apple’s nanny-like attitude.

    @barry
    I used to have a Sidekick, and I also had a Motorola PEBL, and I noticed how each used that special short message and stateful proxy to accomplish low-power AIM. The Sidekick worked perfectly, the PEBL lost state and crashed often. What’s pathetic about Apple is not only have they failed to deliver their own low-power iChat-like iPhone software, they have thusfar failed to provide any facility any facility through which even a resource intensive AIM could exist. Beyond the phone itself, what could be more useful or than mobile AIM?


»  Substance:WordPress   »  Style:Ahren Ahimsa