Header Ads

Tapping into Android's sensors

Summary: Android, a rich platform for application development, has an attractive set of user interface elements and data-management capabilities. Android also offers a healthy array of interfacing options. In this article, learn how to interact with Android's varied sensor options to monitor your environment. Sample code shows you how to record audio on an Android phone. Want to build your own baby monitor? Unlock your phone or a door with your own voice activation? Learn how to leverage the hardware capabilities of an Android-equipped device.

Introduction:
The Android platform is ideal, especially for Java™ developers, for creating innovative applications through the use of hardware sensors. Learn some of the interfacing options available for Android applications, including using the sensor subsystem and recording audio snippets.

What type of applications might you build that would leverage the hardware capabilities of an Android-equipped device? Anything that needs electronic eyes and ears is a good candidate. A baby monitor, a security system, or even a seismograph comes to mind. Though you can't be in two places at once, metaphysically, Android might help bridge that gap in some practical ways. Throughout this article, keep in mind that the Android device in use is not merely a "cell phone" but perhaps a device deployed in a fixed location with wireless network connectivity, such as EDGE or WiFi. Download the source files for the examples in this article.


--------------------------------------------------------------------------------
Back to top
Android sensor capabilities

One refreshing aspect of working with the Android platform is that you can access some of the "goodies" within the device itself. Historically, the inability to access the underlying hardware of a device has been frustrating to mobile developers. Though the Android Java environment still sits between you and the metal, the Android development team brings much of the hardware's capability to the surface. The platform is open source, so you have the flexibility to roll up your sleeves and write some code to accomplish your tasks.

If it is not already installed, you might want to download the Android SDK. You can also browse the contents of the android.hardware package and follow along with the examples in this article. The android.media package contains classes that provide useful and novel functions.

Click to read the rest of the article

No comments:

Powered by Blogger.