Making a beep alert

The first recipe for this chapter is focused on how to play a simple beep sound as a response to an event or an action. Specifically, we'll play a sound when the user clicks on a simple button.

Usually, the beep sound is used for alerting the user. For example, you may want to launch an acoustic signal to indicate that pushing the button is an invalid action.

Instead of beeping, we can use another kind of notification such as an alert box as you've learned in Chapter 2 ,Building Interfaces.

Getting ready

This recipe requires the use of two different frameworks, UiUIKit and PhoneGap. UiUIKit will be used for building a consistent interface. PhoneGap will allow us to interact with the native hardware and play the beep sound.

Remember, ...

Get iPhone JavaScript Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.