Chapter 9. Using Sensors
Mobile phones aren’t just for making phone calls anymore. The iPhone, like a lot of high-end smartphones these days, comes with a number of sensors: camera, accelerometer, GPS module, and digital compass. We’re entering a period of change: more and more users expect these sensors to be integrated into the “application experience.” If your application can make use of them, it probably should.
Hardware Support
Unique among modern mobile platforms, Apple has gone to great lengths to ensure that your code will run on all of the current iOS-based devices. Yet despite this, there is still some variation in hardware between the various models (see Table 9-1).
|
Hardware features |
iPhone |
iPod touch |
iPad |
iPad 2 | New iPad | iPad Mini | |||||||||||
|
3G |
3GS |
4 and 4S |
5 |
1st gen |
2nd gen |
3rd gen |
4th gen |
5th gen |
WiFi |
3G |
WiFi |
3G |
WiFi |
3G |
WiFi |
3G | |
|
Cellular |
✓ |
✓ |
✓ |
✓ |
✗ |
✗ |
✗ |
✗ |
✗ |
✗ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
WiFi |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
Bluetooth |
✓ |
✓ |
✓ |
✓ |
✗ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
Speaker |
✓ |
✓ |
✓ |
✓ |
✗ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
Audio In |
✓ |
✓ |
✓ |
✓ |
✗ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
Accelerometer |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
Magnetometer |
✗ |
✓ |
✓ |
✓ |
✗ |
✗ |
✗ |
✗ |
✗ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
Gyroscope |
✗ |
✗ |
✓ |
✓ |
✗ |
✗ |
✗ |
✓ |
✓ |
✗ |
✗ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
GPS |
✓ |
✓ |
✓ |
✓ |
✗ |
✗ |
✗ |
✗ |
✗ |
✗ |
✓ |
✗ |
✓ |
✗ |
✓ |
✗ |
✓ |
|
Proximity Sensor | |||||||||||||||||
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access