Datasheet
23
Chapter 1: Creating Killer iPhone Applications
Maps and Location
The iPhone OS and hardware allow a developer to determine the device’s
current location, or even to be notified when that location changes. As
people move, it may make sense for your application to tailor itself to where
the user is moment by moment.
There are already plenty of iPhone applications that use location information
to tell you where the nearest coffeehouse is, or even where your friends are.
The MobileTravel411 application uses this information to tell you the nearest
Tube stop and give you directions to your hotel.
When you know the user’s location, you can even put it on a map, along with
other places he or she may be interested in. In Chapter 17, I show you how
easy that really is.
An application that provides these kinds of services can also run in the back-
ground, and what’s more, because using the GPS chip can be a significant
drain on the battery, you have access to services that consume less bat-
tery power — including a location-monitoring service that tracks significant
changes by using only cellular information and the ability to define arbitrary
regions and detect boundary crossings into or out of those regions.
Camera and Photo Library
Your application can also access the pictures stored on the user’s phone — and
by “access” I mean not only display them, but also use or even modify them. The
Photos application, for example, lets you add a photo to a contact, and several
applications enable you to edit your photos on the iPhone itself. You can also
incorporate the standard system interface to actually use the camera as well.
Even more advanced use of the camera is supported. One of the most inter-
esting is augmented reality, where you’re looking through the iPhone camera
at the real world that has computer-generated graphics superimposed.
(Actually it’s much easier — and cooler — than it sounds.)
Playing audio and video
The iPhone OS makes it easy to play and include audio and video in your
application. You can play sound effects or take advantage of the multichan-
nel audio and mixing capabilities available to you. You can also create your
own music player that has access to all the audio contents of the user’s iPod
Library. You can also play back many standard movie file formats, configure
the aspect ratio, and specify whether or not controls are displayed. This
means that your application can not only use the iPhone as a media player,
but also use and control pre-rendered content. And you now can even record
and edit HD videos. Keep in mind that if iMovie can do it, you probably can
do it, too.
Let the games begin!
05_879962-ch01.indd 2305_879962-ch01.indd 23 8/30/10 8:28 PM8/30/10 8:28 PM