O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting Device Information

One of the basic ways to interact with the hardware on the device is to retrieve data about the device itself. In iOS, the device is represented by the UIDevice class, which contains information about the device itself, such as its assigned name, operating system version, and device model (iPad, iPhone, iPod touch). The class also can tell you the orientation of the device (portrait and landscape) and provide status on the battery and the proximity sensor (whether the phone is close to the face of the user).

Listing 14.1 shows some of the ways you can use the UIDevice class. Later sections in this chapter contain other examples of interacting with this data.

Listing 14.1 Getting Information About the Current Device ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required