Mobile computing devices have hardware features that significantly distinguish them from their more stationary counterparts. Hardware features allow the device to both sense and interact with its environment. These features enable the reexamination of assumptions many developers make when developing a piece of software. The ability to sense and interact with the environment allows the developer to rethink business processes encapsulated in software.
Innovative and powerful approaches to solving problems are possible. This suggests that the app developer needs to have a working knowledge of how to integrate the device’s hardware features into an app. This chapter describes how to integrate several different hardware features into an app.
The chapter covers both sensors that can provide information about the device’s internal and external environment and hardware features, such as the camera and phone, provided by the Android platform that can be used independently or integrated into an app.
Determining the presence of a sensor on any specific device is also addressed. Sensors, Managers, and Other Hardware This section covers more sensors and managers used to access sensor data. The section also covers other hardware on some devices that can be used to augment an app’s functionality. Sensors Android devices may have any number of sensors. Two of these, the network and GPS sensors, were discussed in the previous chapter.
However, other sensors may also be used in apps. In all, the Android platform supports about 12 sensors. However, there is no requirement that a manufacturer of an Android device include all of them. For this reason, it is good practice to always check for the presence of a sensor before attempting to use it.
A Sensor Event is an object that is created by a Sensor when it has something to report. This object holds information about the event, including a timestamp for when the object was created, the sensor that produced the event, and data that represents the sensor’s measurements at the time of the event. A Sensor Event Listener is an interface that is implemented by any app that wants to use sensor information encapsulated in a Sensor Event.
Read More About: f95zone