Stuntman And Lover Of Cheese

by Dan Bostonweeks

iPhone: Private Two Ways

This weekend I sat down and I whipped up a little iPhone application to scratch a personal itch. In California it is illegal to operate your motor vehicle and talk on a cell phone without a hands-free device. The most popular hands-free devices use the Bluetooth wireless protocol. On the iPhone it requires a minimum of four touch screen taps to turn Bluetooth on or off. ((Those four taps are: Settings.app, General, Bluetooth, and ON/OFF switch.)) Why would one care about the number of taps? When driving I do have my Bluetooth headset active and the iPhone paired with it. When I’m at work or home I have absolutely no need to use a hands-free device. ((That I hate the bluedouches that refuse to take them off is a large enough subject for another post.)) Since I have no need to use the Bluetooth radio when not using the hands-free device I want a quick toggle for it. Turning it off will save me on battery life a bit and that’s better in the long run. If I can turn the Bluetooth radio on and off with only one tap then I’m more likely to use it. And now a quick tour of the app I wrote: BlueTap. In the home screen for the iPhone the user will see the icon for BlueTap (circled in red). ((The sharp-eyed readers probably see the icon to the far left of BlueTap, another private project that might possibly use a private API, but is not yet ready for prime time.)) image.jpg With the Bluetooth off (notice there is no Bluetooth icon in the status bar of the above image) BlueTap will turn on the Bluetooth radio and present the following screen. image_2.jpg With Bluetooth already powered on BlueTap will turn off the Bluetooth radio and lets the user know this. image_2_2.jpg If you’re in BlueTap and want to change what you’ve done there is no need to quit and relaunch, a simple tap on the Bluetooth logo inside the application will also toggle the Bluetooth radio power. Here is where things get a little tricky, the Bluetooth functionality is using a private and completely unpublished API and framework on the iPhone. This means three things for my simple little application: 1.

I will never be able to distribute this application via the
AppStore official channel;
  1. There is a risk that with the next release of the iPhone OS BlueTap will break because the Bluetooth framework changes;

  2. If I do give this application to friends and acquaintances I will have to stay very on top of changes to the iPhone OS, least it stop working for them.

This evening John Gruber of Daring Fireball published an article about just this subject called Private. I agree with everything John says. I would never distribute an application to the AppStore that used a private API and would have the potential to cause a negative user experience because the private API call went away or was changed. I agree whole-heartedly with Gruber when he says:

The point being that private APIs should be handled with extreme caution — they’re the programming equivalent of explosive material.

Oh yes, explosive indeed. I am fully aware of this and any user of BlueTap other than myself will be made aware of this too. Unlike Landon Fuller, who implemented a very impressive CoverFlow replacement since the CoverFlow API is private, I am unable to re-implement to get this feature, it’s hardware dependent. Hopefully in the future this API will open up or Apple will make a quick settings application for powering on and off features quickly. Until then this private API using application will remain private, for me and my friends.