Online Book Reader

Home Category

Developing Android Applications with Adobe AIR [59]

By Root 2495 0
designed to enable users to share their location with friends and add comments on places visited. You earn points when you discover a new place and badges for interesting locations, and you become the mayor of a location if you are its most frequent visitor.

Geocaching is a worldwide high-tech treasure hunt. A geocacher places an object, also called a geocache, pinpoints its location using GPS, and shares the geocache location online. To play, you enter your postal code, choose a geocode from a list, store the coordinates on your device, and start hunting. Once you find the physical object, you add your name to a logbook and put the object back or replace it with another object of similar value. You can share stories and photos of your experience.

The Complex Network of Global Cargo Ship Movements pieced together the routes of cargo ships over the course of a year using a GPS-based vessel tracking system (http://www.wired.com/wiredscience/2010/01/global-shipping-map/). The marine traffic website displays vessels around the world in real time. The system is based on the Automatic Identification System (AIS) automated tracking system. The International Maritime Organization requires vessels to carry an AIS transponder on board, which transmits their position, speed, and course, among some other static information such as the vessel’s name, dimensions, and voyage details (for more information, go to http://www.marinetraffic.com/ais/).

SiliconSky GPS developed a prototype of an asthma inhaler with built-in GPS tracking capability (http://news.cnet.com/8301-17938_105-10228982-1.html). It tracks asthma inhaler use trends, including the exact time and the geographic location of inhaler users, to better monitor the health issue.

Nike has partnered with Apple to create NikePlus (http://judgeseyesonly.com/nikeplus_video.html), a running shoe that comes equipped with a GPS sensor and transmits your location data to your iPod.

To expose the technology which makes all this possible, GoSatWatch tracks and predicts visible satellites, and displays their path and their location (http://www.gosoftworks.com/GoSatWatch/GoSatWatch.html).

Chapter 11. Microphone and Audio

Sound is the vocabulary of nature.

—Pierre Schaeffer

Audio has a place in mobile applications. Perhaps music is the core element of your project, or sound bites are the final touch to make your application look polished.

This chapter will review what ActionScript has to offer with audio on Android devices. First we will use the microphone, an enhanced modern digital Dictaphone of sorts. Then we will explore the various ways to use audio in your application.

The Microphone


You can use the microphone in many applications on a mobile device. For example, you can take quick audio notes. You can add an audio caption to your photograph. You can even create a DJ multitrack tool with a convenient multitouch interface.

flash.media.Microphone is a static class for monitoring and capturing audio from the device’s native microphone. It is a subclass of the EventDispatcher class.

Your application needs the audio permission to use it:

First make sure your device has a microphone and gives you access to it:

import flash.media.Microphone;

if (Microphone.isSupported) {

// continue on

}

If it does, create a reference to it through its getMicrophone method. On Android devices, you only have access to one microphone:

var microphone:Microphone = Microphone.getMicrophone();

The microphone has several properties that you can set to improve your recording.

gain works as a volume multiplier and has a value between 0 and 100. The default value is 50 or a multiplier of 1. Any value above 50 boosts the microphone and below reduces it.

You want to boost the microphone to the maximum, not only because the mobile hardware is of a lesser quality than your desktop, but also because your users may be outdoors, or in a noisy place, while using your application:

microphone.gain = 100;

rate defines

Return Main Page Previous Page Next Page

®Online Book Reader