Chapter 17. Bluetooth Programming
WHAT YOU WILL LEARN IN THIS CHAPTER
How to use the various APIs within the Game Kit framework for Bluetooth communications
How to look for peer Bluetooth devices using the GKPeerPickerController class
How to send and receive data from a connected device
How to implement Bluetooth voice chat
The iPhone comes with built-in Bluetooth functionality, enabling it to communicate with other Bluetooth devices, such as Bluetooth headsets, iPhone, iPod touch, and iPad. This chapter shows you how to write iPhone applications that use Bluetooth to communicate with another device, performing tasks such as sending and receiving text messages, as well as voice chatting. Daunting as it may sound, Bluetooth programming is actually quite simple using the iPhone SDK. All the Bluetooth functionalities are encapsulated within the Game Kit framework.
To test the concepts covered in this chapter, you need two devices: iPads, iPhones (4, 3G or 3GS), or iPod touches (second generation or later) running iPhone OS 3.0 or later.
Using the Game Kit Framework
One of the neat features available in the iPhone SDK is the Game Kit framework, which contains APIs that enable communications over a Bluetooth network. You can use these APIs to create peer-to-peer games and applications with ease. Unlike other mobile platforms, using Bluetooth as a communication channel in the iPhone is much easier than you might expect. In this section, you will learn how to build a simple application that ...