Hardware Tools for Android App Development
Google gives developers the tools necessary to create top-notch, full-featured mobile apps. Google makes it simple to tap into, and make use of, all available hardware on a device.
To create a spectacular Android app, you should take advantage of all that the hardware has to offer. Don’t get us wrong — if you have an idea for an app that needs no hardware assistance, that’s okay, too.
Android devices come supplied with several hardware features that you can use to build apps. The table describes the hardware features available on most Android devices.
|Android Hardware Feature||What It Does|
|Accelerometer||Indicates whether the phone is moving|
|Bluetooth radio||Indicates whether a headset is connected|
|Compass||Indicates in which direction the user is heading|
|Camera||Take pictures and record video|
|GPS receiver||Indicates the user’s location|
Most Android devices are released with the hardware discussed in the following four sections, but not all devices are created equal. Android is free for hardware manufacturers to distribute, so it’s used in a wide range of devices, including some made by small manufacturers overseas (and it isn’t uncommon for some of these devices to be missing a feature or two).
Android devices come in all shapes and sizes: phones, tablets, ebook readers, watches, televisions, and cars. The engineers behind Android provide tools that let you easily deploy apps on multiple screen sizes and resolutions. Don’t worry — the Android team has done all the hard work for you.
The Android touchscreen opens a ton of possibilities to enhance users’ interaction with your apps. Users can swipe, flip, drag, or pinch to zoom, for example, by moving a finger on the touchscreen. You can even supply custom gestures in your app, which opens even more possibilities.
Android also supports multitouch capability, which lets a user touch the entire screen with more than one finger at a time.
Hardware buttons are old news. You can place buttons of any shape anywhere on the screen to create the user interface best suited for your app.
Combining the Android operating system with the GPS receiver on a device lets the developer access, and track, a user’s location at any time. The Foursquare social networking app is a good example — it uses the GPS feature to determine the user’s location and then accesses the web to determine the closest venues to the user.
Another helpful example is the Maps application’s ability to pinpoint a user’s location on a map and provide directions to that person’s destination. Combining Android with GPS hardware gives you access to the user’s exact GPS location. Many apps use this combination to show users where the nearest gas station, coffeehouse, or even restroom is located.
An accelerometer is a device that measures acceleration, and Android comes packed with accelerometer support. The accelerometer tells you whether a user’s device is being moved or shaken, and even in which direction it’s being turned. You can then use this information as a way to control your application.
You can use the accelerometer to perform simple tasks, such as determining when the device has been turned upside down and then completing an action. For example, you can immerse users in game play by having them shake their device to roll the dice. This level of usefulness is setting mobile devices apart from typical desktop personal computers.
Android has activity recognition built in, which uses various sensors such as the accelerometer and the GPS to determine whether your user is likely walking, running, driving, or bicycling right now.
Android gives you the tools you need to access (save and load) files on the device’s SD card — a portable storage medium that you can insert into compatible phones, tablets, and computers. To avoid bloating your app with extra required resources and hogging limited built-in memory, you can download some or all of your application’s resources from your web host and save them to the device’s SD card (which makes users less likely to uninstall your app when they need to clear space on their devices).
Not every device has an SD card preinstalled, though most do. Always ensure that a device has an SD card installed and that adequate space is available before trying to save files to it. Also, be aware that any file you place on an SD card is not secure, and can be read by other apps on the user’s phone.