<!DOCTYPE html>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
--><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
<meta name="generator" content="joDoc">
<title>Apache Cordova API Documentation</title>
<link rel="stylesheet" type="text/css" href="index.css">
<link rel="stylesheet" type="text/css" href="mobile.css" media="only screen and (max-device-width: 1024px)">
<link rel="stylesheet" type="text/css" href="prettify/prettify.css">
</head>
<body>
        <div id="header">
            <h1><a href="index.html">Apache <strong>Cordova</strong> Documentation</a></h1>
            <small>
                <select><optgroup label="English" value="en">
<option value="edge">edge</option>
<option value="2.9.0rc1">2.9.0rc1</option>
<option value="2.9.0">2.9.0</option>
<option value="2.8.0">2.8.0</option>
<option value="2.7.0rc1">2.7.0rc1</option>
<option value="2.7.0">2.7.0</option>
<option value="2.6.0rc1">2.6.0rc1</option>
<option value="2.6.0">2.6.0</option>
<option value="2.5.0rc1">2.5.0rc1</option>
<option value="2.5.0">2.5.0</option>
<option value="2.4.0rc1">2.4.0rc1</option>
<option value="2.4.0">2.4.0</option>
<option value="2.3.0rc2">2.3.0rc2</option>
<option value="2.3.0rc1">2.3.0rc1</option>
<option value="2.3.0">2.3.0</option>
<option value="2.2.0rc2">2.2.0rc2</option>
<option value="2.2.0rc1">2.2.0rc1</option>
<option value="2.2.0">2.2.0</option>
<option value="2.1.0rc2">2.1.0rc2</option>
<option value="2.1.0rc1">2.1.0rc1</option>
<option value="2.1.0">2.1.0</option>
<option value="2.0.0rc1">2.0.0rc1</option>
<option value="2.0.0">2.0.0</option>
<option selected value="1.9.0rc1">1.9.0rc1</option>
<option value="1.9.0">1.9.0</option>
<option value="1.8.1">1.8.1</option>
<option value="1.8.0rc1">1.8.0rc1</option>
<option value="1.8.0">1.8.0</option>
<option value="1.7.0rc1">1.7.0rc1</option>
<option value="1.7.0">1.7.0</option>
<option value="1.6.1">1.6.1</option>
<option value="1.6.0rc1">1.6.0rc1</option>
<option value="1.6.0">1.6.0</option>
<option value="1.5.0rc1">1.5.0rc1</option>
<option value="1.5.0">1.5.0</option>
</optgroup>
<optgroup label="Japanese" value="jp">
<option value="2.2.0">2.2.0</option>
<option value="2.1.0">2.1.0</option>
<option value="2.0.0">2.0.0</option>
<option value="1.9.0">1.9.0</option>
<option value="1.8.1">1.8.1</option>
<option value="1.7.0">1.7.0</option>
</optgroup>
<optgroup label="Korean" value="kr"><option value="2.0.0">2.0.0</option></optgroup></select></small>
        </div>
        <div id="subheader">
            <h1>Events</h1>
            <small><select><option value="Events">Events</option>
<option value="Events_event_types">      - Event Types</option>
<option value="Events_permissions">      - Permissions</option>
<option value="deviceready">deviceready</option>
<option value="deviceready_details">      - Details</option>
<option value="deviceready_supported_platforms">      - Supported Platforms</option>
<option value="deviceready_quick_example">      - Quick Example</option>
<option value="deviceready_full_example">      - Full Example</option>
<option value="pause">pause</option>
<option value="pause_details">      - Details</option>
<option value="pause_supported_platforms">      - Supported Platforms</option>
<option value="pause_quick_example">      - Quick Example</option>
<option value="pause_full_example">      - Full Example</option>
<option value="pause_ios_quirks">      - iOS Quirks</option>
<option value="resume">resume</option>
<option value="resume_details">      - Details</option>
<option value="resume_supported_platforms">      - Supported Platforms</option>
<option value="resume_quick_example">      - Quick Example</option>
<option value="resume_full_example">      - Full Example</option>
<option value="resume_ios_quirks">      - iOS Quirks</option>
<option value="online">online</option>
<option value="online_details">      - Details</option>
<option value="online_supported_platforms">      - Supported Platforms</option>
<option value="online_quick_example">      - Quick Example</option>
<option value="online_full_example">      - Full Example</option>
<option value="online_ios_quirks">      - iOS Quirks</option>
<option value="online_windows_phone_7_quirks">      - Windows Phone 7 Quirks</option>
<option value="offline">offline</option>
<option value="offline_details">      - Details</option>
<option value="offline_supported_platforms">      - Supported Platforms</option>
<option value="offline_quick_example">      - Quick Example</option>
<option value="offline_full_example">      - Full Example</option>
<option value="offline_ios_quirks">      - iOS Quirks</option>
<option value="offline_windows_phone_7_quirks">      - Windows Phone 7 Quirks</option>
<option value="backbutton">backbutton</option>
<option value="backbutton_details">      - Details</option>
<option value="backbutton_supported_platforms">      - Supported Platforms</option>
<option value="backbutton_quick_example">      - Quick Example</option>
<option value="backbutton_full_example">      - Full Example</option>
<option value="batterycritical">batterycritical</option>
<option value="batterycritical_details">      - Details</option>
<option value="batterycritical_supported_platforms">      - Supported Platforms</option>
<option value="batterycritical_quick_example">      - Quick Example</option>
<option value="batterycritical_full_example">      - Full Example</option>
<option value="batterylow">batterylow</option>
<option value="batterylow_details">      - Details</option>
<option value="batterylow_supported_platforms">      - Supported Platforms</option>
<option value="batterylow_quick_example">      - Quick Example</option>
<option value="batterylow_full_example">      - Full Example</option>
<option value="batterystatus">batterystatus</option>
<option value="batterystatus_details">      - Details</option>
<option value="batterystatus_supported_platforms">      - Supported Platforms</option>
<option value="batterystatus_windows_phone_7_quirks">      - Windows Phone 7 Quirks</option>
<option value="batterystatus_quick_example">      - Quick Example</option>
<option value="batterystatus_full_example">      - Full Example</option>
<option value="menubutton">menubutton</option>
<option value="menubutton_details">      - Details</option>
<option value="menubutton_supported_platforms">      - Supported Platforms</option>
<option value="menubutton_quick_example">      - Quick Example</option>
<option value="menubutton_full_example">      - Full Example</option>
<option value="searchbutton">searchbutton</option>
<option value="searchbutton_details">      - Details</option>
<option value="searchbutton_supported_platforms">      - Supported Platforms</option>
<option value="searchbutton_quick_example">      - Quick Example</option>
<option value="searchbutton_full_example">      - Full Example</option>
<option value="startcallbutton">startcallbutton</option>
<option value="startcallbutton_details">      - Details</option>
<option value="startcallbutton_supported_platforms">      - Supported Platforms</option>
<option value="startcallbutton_quick_example">      - Quick Example</option>
<option value="startcallbutton_full_example">      - Full Example</option>
<option value="endcallbutton">endcallbutton</option>
<option value="endcallbutton_details">      - Details</option>
<option value="endcallbutton_supported_platforms">      - Supported Platforms</option>
<option value="endcallbutton_quick_example">      - Quick Example</option>
<option value="endcallbutton_full_example">      - Full Example</option>
<option value="volumedownbutton">volumedownbutton</option>
<option value="volumedownbutton_details">      - Details</option>
<option value="volumedownbutton_supported_platforms">      - Supported Platforms</option>
<option value="volumedownbutton_quick_example">      - Quick Example</option>
<option value="volumedownbutton_full_example">      - Full Example</option>
<option value="volumeupbutton">volumeupbutton</option>
<option value="volumeupbutton_details">      - Details</option>
<option value="volumeupbutton_supported_platforms">      - Supported Platforms</option>
<option value="volumeupbutton_quick_example">      - Quick Example</option>
<option value="volumeupbutton_full_example">      - Full Example</option></select></small>
        </div>

        <div id="sidebar">
            <div class="vertical_divider"></div>
        <h1>API Reference</h1>
<ul>
<li><a href="cordova_accelerometer_accelerometer.md.html#Accelerometer">Accelerometer</a></li>
<li><a href="cordova_camera_camera.md.html#Camera">Camera</a></li>
<li><a href="cordova_media_capture_capture.md.html#Capture">Capture</a></li>
<li><a href="cordova_compass_compass.md.html#Compass">Compass</a></li>
<li><a href="cordova_connection_connection.md.html#Connection">Connection</a></li>
<li><a href="cordova_contacts_contacts.md.html#Contacts">Contacts</a></li>
<li><a href="cordova_device_device.md.html#Device">Device</a></li>
<li><a href="cordova_events_events.md.html#Events">Events</a></li>
<li><a href="cordova_file_file.md.html#File">File</a></li>
<li><a href="cordova_geolocation_geolocation.md.html#Geolocation">Geolocation</a></li>
<li><a href="cordova_media_media.md.html#Media">Media</a></li>
<li><a href="cordova_notification_notification.md.html#Notification">Notification</a></li>
<li><a href="cordova_storage_storage.md.html#Storage">Storage</a></li>
</ul>
<h1>Guides</h1>
<ul>
<li><a href="guide_getting-started_index.md.html#Getting%20Started%20Guides">Getting Started Guides</a></li>
<li><a href="guide_command-line_index.md.html#Command-Line%20Usage">Command-Line Usage</a></li>
<li><a href="guide_upgrading_index.md.html#Upgrading%20Guides">Upgrading Guides</a></li>
<li><a href="guide_whitelist_index.md.html#Domain%20Whitelist%20Guide">Domain Whitelist Guide</a></li>
<li><a href="_index.html">Keyword Index</a></li>
</ul>
</div>

        <div id="scrollable">
            <div id="content">
                <h1><a name="Events">Events</a></h1>

<blockquote>
  <p>Cordova lifecycle events.</p>
</blockquote>

<h2>
<a name="Events_event_types">Event Types</a>
</h2>

<ul>
<li><a href="cordova_events_events.md.html#deviceready">deviceready</a></li>
<li><a href="cordova_events_events.md.html#pause">pause</a></li>
<li><a href="cordova_events_events.md.html#resume">resume</a></li>
<li><a href="cordova_events_events.md.html#online">online</a></li>
<li><a href="cordova_events_events.md.html#offline">offline</a></li>
<li><a href="cordova_events_events.md.html#backbutton">backbutton</a></li>
<li><a href="cordova_events_events.md.html#batterycritical">batterycritical</a></li>
<li><a href="cordova_events_events.md.html#batterylow">batterylow</a></li>
<li><a href="cordova_events_events.md.html#batterystatus">batterystatus</a></li>
<li><a href="cordova_events_events.md.html#menubutton">menubutton</a></li>
<li><a href="cordova_events_events.md.html#searchbutton">searchbutton</a></li>
<li><a href="cordova_events_events.md.html#startcallbutton">startcallbutton</a></li>
<li><a href="cordova_events_events.md.html#endcallbutton">endcallbutton</a></li>
<li><a href="cordova_events_events.md.html#volumedownbutton">volumedownbutton</a></li>
<li><a href="cordova_events_events.md.html#volumeupbutton">volumeupbutton</a></li>
</ul>
<h2>
<a name="Events_permissions">Permissions</a>
</h2>

<h3>Android</h3>

<h4>app/res/xml/plugins.xml</h4>

<pre class="prettyprint"><code>&lt;plugin name="Battery" value="org.apache.cordova.BatteryListener" /&gt;
</code></pre>

<h4>app/AndroidManifest.xml</h4>

<pre class="prettyprint"><code>&lt;uses-permission android:name="android.permission.BROADCAST_STICKY" /&gt;
</code></pre>

<h3>Bada</h3>

<h4>manifest.xml</h4>

<pre class="prettyprint"><code>&lt;Privilege&gt;
    &lt;Name&gt;SYSTEM_SERVICE&lt;/Name&gt;
&lt;/Privilege&gt;
</code></pre>

<h3>BlackBerry WebWorks</h3>

<h4>www/plugins.xml</h4>

<pre class="prettyprint"><code>&lt;plugin name="Battery" value="org.apache.cordova.battery.Battery" /&gt;
</code></pre>

<h4>www/config.xml</h4>

<pre class="prettyprint"><code>&lt;feature id="blackberry.app"          required="true" version="1.0.0.0" /&gt;
&lt;feature id="blackberry.app.event"    required="true" version="1.0.0.0" /&gt;
&lt;feature id="blackberry.system.event" required="true" version="1.0.0.0" /&gt;
</code></pre>

<h3>iOS</h3>

<h4>App/Supporting Files/Cordova.plist</h4>

<pre class="prettyprint"><code>&lt;key&gt;Plugins&lt;/key&gt;
&lt;dict&gt;
    &lt;key&gt;Battery&lt;/key&gt;
    &lt;string&gt;CDVBattery&lt;/string&gt;
&lt;/dict&gt;
</code></pre>

<h3>webOS</h3>

<pre class="prettyprint"><code>No permissions are required.
</code></pre>

<h3>Windows Phone</h3>

<pre class="prettyprint"><code>No permissions are required.
</code></pre>

<hr>
<h1><a name="deviceready">deviceready</a></h1>

<p>This is an event that fires when Cordova is fully loaded.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="deviceready_details">Details</a>
</h2>

<p>This is a very important event that every Cordova application should use.</p>

<p>Cordova consists of two code bases: native and JavaScript. While the native code is loading, a custom loading image is displayed. However, JavaScript is only loaded once the DOM loads. This means your web application could, potentially, call a Cordova JavaScript function before it is loaded.</p>

<p>The Cordova <code><a href="cordova_events_events.md.html#deviceready">deviceready</a></code> event fires once Cordova has fully loaded. After the device has fired, you can safely make calls to Cordova function.</p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once the HTML document's DOM has loaded.</p>

<h2>
<a name="deviceready_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
<li>iOS</li>
<li>Windows Phone 7</li>
<li>Bada 1.2 &amp; 2.x</li>
</ul>
<h2>
<a name="deviceready_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);

function onDeviceReady() {
    // Now safe to use the Cordova API
}
</code></pre>

<h2>
<a name="deviceready_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova <a href="cordova_device_device.md.html#Device">Device</a> Ready Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        // Now safe to use the Cordova API
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="pause">pause</a></h1>

<p>This is an event that fires when a Cordova application is put into the background.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#pause">pause</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="pause_details">Details</a>
</h2>

<p>Cordova consists of two code bases: native and JavaScript. While the native code puts the application into the background the <a href="cordova_events_events.md.html#pause">pause</a> event is fired.  </p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="pause_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
<li>iOS</li>
<li>Windows Phone 7</li>
</ul>
<h2>
<a name="pause_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#pause">pause</a>", onPause, false);

function onPause() {
    // Handle the <a href="cordova_events_events.md.html#pause">pause</a> event
}
</code></pre>

<h2>
<a name="pause_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Pause Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        document.addEventListener("<a href="cordova_events_events.md.html#pause">pause</a>", onPause, false);
    }

    // Handle the <a href="cordova_events_events.md.html#pause">pause</a> event
    //
    function onPause() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<h2>
<a name="pause_ios_quirks">iOS Quirks</a>
</h2>

<p>In the <a href="cordova_events_events.md.html#pause">pause</a> handler, any calls that go through Objective-C will not work, nor will any calls that are interactive, like alerts. This means that you cannot call console.log (and its variants), or any calls from Plugins or the Cordova API. These will only be processed when the app resumes (processed on the next run-loop).</p>

<ul>
<li>
<p><strong>resign</strong> event </p>

<p>This iOS specific event is available as a variant of the <strong><a href="cordova_events_events.md.html#pause">pause</a></strong> event, and is often used to detect when the "Lock" button has been pressed to lock the device when your app is the foreground app. If your app (and device) is enabled for multi-tasking, this will be paired with a subsequent <strong><a href="cordova_events_events.md.html#pause">pause</a></strong> event, but only under iOS 5 (effectively all "locked" apps in iOS 5 that have multi-tasking enabled are put to the background). </p>

<p>Under iOS 5, if you want your app to still run when the device is locked, you will have to disable multi-tasking (UIApplicationExitsOnSuspend - YES) for your app. This is different when you are on iOS 4 - to have your app run when the device is locked, the multi-tasking setting for your app does not matter.</p>
</li>
</ul>
<hr>
<h1><a name="resume">resume</a></h1>

<p>This is an event that fires when a Cordova application is retrieved from the background.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#resume">resume</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="resume_details">Details</a>
</h2>

<p>Cordova consists of two code bases: native and JavaScript. While the native code pulls the application from the background the <a href="cordova_events_events.md.html#resume">resume</a> event is fired.  </p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="resume_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
<li>iOS</li>
<li>Windows Phone 7</li>
</ul>
<h2>
<a name="resume_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#resume">resume</a>", onResume, false);

function onResume() {
    // Handle the <a href="cordova_events_events.md.html#resume">resume</a> event
}
</code></pre>

<h2>
<a name="resume_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Resume Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        document.addEventListener("<a href="cordova_events_events.md.html#resume">resume</a>", onResume, false);
    }

    // Handle the <a href="cordova_events_events.md.html#resume">resume</a> event
    //
    function onResume() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<h2>
<a name="resume_ios_quirks">iOS Quirks</a>
</h2>

<p>Any calls to console.log during your <strong><a href="cordova_events_events.md.html#pause">pause</a></strong> event handler will be run now when the app resumes, see the iOS Quirks section for the <strong><a href="cordova_events_events.md.html#pause">pause</a></strong> event for an explanation. </p>

<ul>
<li>
<p><strong>active</strong> event </p>

<p>This iOS specific event is available as a variant of the <strong><a href="cordova_events_events.md.html#resume">resume</a></strong> event, and is often used to detect when the "Lock" button has been pressed to unlock the device when your app is the foreground app. If your app (and device) is enabled for multi-tasking, this will be paired with a subsequent <strong><a href="cordova_events_events.md.html#resume">resume</a></strong> event, but only under iOS 5 (effectively all "locked" apps in iOS 5 that have multi-tasking enabled are put to the background). </p>

<p>Under iOS 5,  if you want your app to still run when the device is locked, you will have to disable multi-tasking (UIApplicationExitsOnSuspend - YES) for your app. This is different when you are on iOS 4 - to have your app run when the device is locked, the multi-tasking setting for your app does not matter.</p>
</li>
</ul>
<hr>
<h1><a name="online">online</a></h1>

<p>This is an event that fires when a Cordova application is <a href="cordova_events_events.md.html#online">online</a> (connected to the Internet).</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#online">online</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="online_details">Details</a>
</h2>

<p>When the application's network connection changes to being <a href="cordova_events_events.md.html#online">online</a>, the <a href="cordova_events_events.md.html#online">online</a> event is fired.  </p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="online_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
<li>iOS</li>
<li>Windows Phone 7</li>
</ul>
<h2>
<a name="online_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#online">online</a>", onOnline, false);

function onOnline() {
    // Handle the <a href="cordova_events_events.md.html#online">online</a> event
}
</code></pre>

<h2>
<a name="online_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Online Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        document.addEventListener("<a href="cordova_events_events.md.html#online">online</a>", onOnline, false);
    }

    // Handle the <a href="cordova_events_events.md.html#online">online</a> event
    //
    function onOnline() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<h2>
<a name="online_ios_quirks">iOS Quirks</a>
</h2>

<p>During initial startup, the first <a href="cordova_events_events.md.html#online">online</a> event (if applicable) will take at least a second to fire.</p>

<h2>
<a name="online_windows_phone_7_quirks">Windows Phone 7 Quirks</a>
</h2>

<p>When running in the Emulator, the connection.status of the device is always unknown, and this event will NOT fire.</p>

<hr>
<h1><a name="offline">offline</a></h1>

<p>This is an event that fires when a Cordova application is <a href="cordova_events_events.md.html#offline">offline</a> (not connected to the Internet).</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#offline">offline</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="offline_details">Details</a>
</h2>

<p>When the application's network connection changes to being <a href="cordova_events_events.md.html#offline">offline</a>, the <a href="cordova_events_events.md.html#offline">offline</a> event is fired.  </p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="offline_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
<li>iOS</li>
<li>Windows Phone 7</li>
</ul>
<h2>
<a name="offline_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#offline">offline</a>", onOffline, false);

function onOffline() {
    // Handle the <a href="cordova_events_events.md.html#offline">offline</a> event
}
</code></pre>

<h2>
<a name="offline_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Offline Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        document.addEventListener("<a href="cordova_events_events.md.html#offline">offline</a>", onOffline, false);
    }

    // Handle the <a href="cordova_events_events.md.html#offline">offline</a> event
    //
    function onOffline() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<h2>
<a name="offline_ios_quirks">iOS Quirks</a>
</h2>

<p>During initial startup, the first <a href="cordova_events_events.md.html#offline">offline</a> event (if applicable) will take at least a second to fire.</p>

<h2>
<a name="offline_windows_phone_7_quirks">Windows Phone 7 Quirks</a>
</h2>

<p>When running in the Emulator, the connection.status of the device is always unknown, and this event will NOT fire.</p>

<hr>
<h1><a name="backbutton">backbutton</a></h1>

<p>This is an event that fires when the user presses the back button.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#backbutton">backbutton</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="backbutton_details">Details</a>
</h2>

<p>If you need to override the default back button behaviour you can register an event listener for the '<a href="cordova_events_events.md.html#backbutton">backbutton</a>' event.  It is no longer necessary to call any other method to over ride the back button behaviour.  Now, you only need to register an event listener for '<a href="cordova_events_events.md.html#backbutton">backbutton</a>'.</p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="backbutton_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
<li>Windows Phone 7 ( Mango )</li>
</ul>
<h2>
<a name="backbutton_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#backbutton">backbutton</a>", onBackKeyDown, false);

function onBackKeyDown() {
    // Handle the back button
}
</code></pre>

<h2>
<a name="backbutton_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Back Button Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to call Cordova methods
    //
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("<a href="cordova_events_events.md.html#backbutton">backbutton</a>", onBackKeyDown, false);
    }

    // Handle the back button
    //
    function onBackKeyDown() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="batterycritical">batterycritical</a></h1>

<p>This is an event that fires when a Cordova application detects the battery has reached the critical level threshold.</p>

<pre class="prettyprint"><code>window.addEventListener("<a href="cordova_events_events.md.html#batterycritical">batterycritical</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="batterycritical_details">Details</a>
</h2>

<p>This event that fires when a Cordova application detects the percentage of battery has reached the critical battery threshold. This value is device specific.</p>

<p>The <a href="cordova_events_events.md.html#batterycritical">batterycritical</a> handler will be called with an object that contains two properties:</p>

<ul>
<li>
<strong>level:</strong> The percentage of battery (0-100). <em>(Number)</em>
</li>
<li>
<strong>isPlugged:</strong> A boolean that represents whether or not the device is plugged in or not. <em>(Boolean)</em>
</li>
</ul>
<p>Typically, you will want to attach an event listener with <code>window.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="batterycritical_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>iOS</li>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
</ul>
<h2>
<a name="batterycritical_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>window.addEventListener("<a href="cordova_events_events.md.html#batterycritical">batterycritical</a>", onBatteryCritical, false);

function onBatteryCritical(info) {
    // Handle the battery critical event
    alert("Battery Level Critical " + info.level + "%\nRecharge Soon!"); 
}
</code></pre>

<h2>
<a name="batterycritical_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova <a href="cordova_device_device.md.html#Device">Device</a> Ready Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    // 
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        window.addEventListener("<a href="cordova_events_events.md.html#batterycritical">batterycritical</a>", onBatteryCritical, false);
    }

    // Handle the <a href="cordova_events_events.md.html#batterycritical">batterycritical</a> event
    //
    function onBatteryCritical(info) {
        alert("Battery Level Critical " + info.level + "%\nRecharge Soon!"); 
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="batterylow">batterylow</a></h1>

<p>This is an event that fires when a Cordova application detects the battery has reached the low level threshold.</p>

<pre class="prettyprint"><code>window.addEventListener("<a href="cordova_events_events.md.html#batterylow">batterylow</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="batterylow_details">Details</a>
</h2>

<p>This event that fires when a Cordova application detects the percentage of battery has reached the low battery threshold. This value is device specific.</p>

<p>The <a href="cordova_events_events.md.html#batterylow">batterylow</a> handler will be called with an object that contains two properties:</p>

<ul>
<li>
<strong>level:</strong> The percentage of battery (0-100). <em>(Number)</em>
</li>
<li>
<strong>isPlugged:</strong> A boolean that represents whether or not the device is plugged in or not. <em>(Boolean)</em>
</li>
</ul>
<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="batterylow_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>iOS</li>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
</ul>
<h2>
<a name="batterylow_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>window.addEventListener("<a href="cordova_events_events.md.html#batterylow">batterylow</a>", onBatteryLow, false);

function onBatteryLow(info) {
    // Handle the battery low event
    alert("Battery Level Low " + info.level + "%"); 
}
</code></pre>

<h2>
<a name="batterylow_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova <a href="cordova_device_device.md.html#Device">Device</a> Ready Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    // 
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        window.addEventListener("<a href="cordova_events_events.md.html#batterylow">batterylow</a>", onBatteryLow, false);
    }

    // Handle the <a href="cordova_events_events.md.html#batterylow">batterylow</a> event
    //
    function onBatteryLow(info) {
        alert("Battery Level Low " + info.level + "%"); 
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="batterystatus">batterystatus</a></h1>

<p>This is an event that fires when a Cordova application detects a change in the battery status.</p>

<pre class="prettyprint"><code>window.addEventListener("<a href="cordova_events_events.md.html#batterystatus">batterystatus</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="batterystatus_details">Details</a>
</h2>

<p>This event that fires when a Cordova application detects the percentage of battery has changed by at least 1 percent. It is also fired if the device has been plugged in or un-plugged.</p>

<p>The battery status handler will be called with an object that contains two properties:</p>

<ul>
<li>
<strong>level:</strong> The percentage of battery (0-100). <em>(Number)</em>
</li>
<li>
<strong>isPlugged:</strong> A boolean that represents whether or not the device is plugged in or not. <em>(Boolean)</em>
</li>
</ul>
<p>Typically, you will want to attach an event listener with <code>window.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="batterystatus_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>iOS</li>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
<li>Windows Phone 7 ( Mango )</li>
</ul>
<h2>
<a name="batterystatus_windows_phone_7_quirks">Windows Phone 7 Quirks</a>
</h2>

<p>The <code>level</code> property is unavailable as Windows Phone 7 does not provide
native APIs for determining battery level. The <code>isPlugged</code> parameter
<em>is</em> supported.</p>

<h2>
<a name="batterystatus_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>window.addEventListener("<a href="cordova_events_events.md.html#batterystatus">batterystatus</a>", onBatteryStatus, false);

function onBatteryStatus(info) {
    // Handle the <a href="cordova_events_events.md.html#online">online</a> event
    console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
}
</code></pre>

<h2>
<a name="batterystatus_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova <a href="cordova_device_device.md.html#Device">Device</a> Ready Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    // 
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        window.addEventListener("<a href="cordova_events_events.md.html#batterystatus">batterystatus</a>", onBatteryStatus, false);
    }

    // Handle the <a href="cordova_events_events.md.html#batterystatus">batterystatus</a> event
    //
    function onBatteryStatus(info) {
        console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="menubutton">menubutton</a></h1>

<p>This is an event that fires when the user presses the menu button.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#menubutton">menubutton</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="menubutton_details">Details</a>
</h2>

<p>If you need to override the default menu button behaviour you can register an event listener for the '<a href="cordova_events_events.md.html#menubutton">menubutton</a>' event.</p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="menubutton_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>Android</li>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
</ul>
<h2>
<a name="menubutton_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#menubutton">menubutton</a>", onMenuKeyDown, false);

function onMenuKeyDown() {
    // Handle the back button
}
</code></pre>

<h2>
<a name="menubutton_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Menu Button Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("<a href="cordova_events_events.md.html#menubutton">menubutton</a>", onMenuKeyDown, false);
    }

    // Handle the menu button
    //
    function onMenuKeyDown() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="searchbutton">searchbutton</a></h1>

<p>This is an event that fires when the user presses the search button on Android.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#searchbutton">searchbutton</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="searchbutton_details">Details</a>
</h2>

<p>If you need to override the default search button behaviour on Android you can register an event listener for the '<a href="cordova_events_events.md.html#searchbutton">searchbutton</a>' event.</p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="searchbutton_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>Android</li>
</ul>
<h2>
<a name="searchbutton_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#searchbutton">searchbutton</a>", onSearchKeyDown, false);

function onSearchKeyDown() {
    // Handle the search button
}
</code></pre>

<h2>
<a name="searchbutton_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Search Button Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("<a href="cordova_events_events.md.html#searchbutton">searchbutton</a>", onSearchKeyDown, false);
    }

    // Handle the search button
    //
    function onSearchKeyDown() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="startcallbutton">startcallbutton</a></h1>

<p>This is an event that fires when the user presses the start call button.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#startcallbutton">startcallbutton</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="startcallbutton_details">Details</a>
</h2>

<p>If you need to override the default start call behaviour you can register an event listener for the '<a href="cordova_events_events.md.html#startcallbutton">startcallbutton</a>' event.</p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="startcallbutton_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
</ul>
<h2>
<a name="startcallbutton_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#startcallbutton">startcallbutton</a>", onStartCallKeyDown, false);

function onStartCallKeyDown() {
    // Handle the start call button
}
</code></pre>

<h2>
<a name="startcallbutton_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Start Call Button Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("<a href="cordova_events_events.md.html#startcallbutton">startcallbutton</a>", onStartCallKeyDown, false);
    }

    // Handle the start call button
    //
    function onStartCallKeyDown() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="endcallbutton">endcallbutton</a></h1>

<p>This is an event that fires when the user presses the end call button.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#endcallbutton">endcallbutton</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="endcallbutton_details">Details</a>
</h2>

<p>If you need to override the default end call behaviour you can register an event listener for the '<a href="cordova_events_events.md.html#endcallbutton">endcallbutton</a>' event.</p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="endcallbutton_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
</ul>
<h2>
<a name="endcallbutton_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#endcallbutton">endcallbutton</a>", onEndCallKeyDown, false);

function onEndCallKeyDown() {
    // Handle the end call button
}
</code></pre>

<h2>
<a name="endcallbutton_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova End Call Button Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("<a href="cordova_events_events.md.html#endcallbutton">endcallbutton</a>", onEndCallKeyDown, false);
    }

    // Handle the end call button
    //
    function onEndCallKeyDown() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="volumedownbutton">volumedownbutton</a></h1>

<p>This is an event that fires when the user presses the volume down button.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#volumedownbutton">volumedownbutton</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="volumedownbutton_details">Details</a>
</h2>

<p>If you need to override the default volume down behaviour you can register an event listener for the '<a href="cordova_events_events.md.html#volumedownbutton">volumedownbutton</a>' event.</p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="volumedownbutton_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
</ul>
<h2>
<a name="volumedownbutton_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#volumedownbutton">volumedownbutton</a>", onVolumeDownKeyDown, false);

function onVolumeDownKeyDown() {
    // Handle the volume down button
}
</code></pre>

<h2>
<a name="volumedownbutton_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Volume Down Button Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("<a href="cordova_events_events.md.html#volumedownbutton">volumedownbutton</a>", onVolumeDownKeyDown, false);
    }

    // Handle the volume down button
    //
    function onVolumeDownKeyDown() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<hr>
<h1><a name="volumeupbutton">volumeupbutton</a></h1>

<p>This is an event that fires when the user presses the volume up button.</p>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#volumeupbutton">volumeupbutton</a>", yourCallbackFunction, false);
</code></pre>

<h2>
<a name="volumeupbutton_details">Details</a>
</h2>

<p>If you need to override the default volume up behaviour you can register an event listener for the '<a href="cordova_events_events.md.html#volumeupbutton">volumeupbutton</a>' event.</p>

<p>Typically, you will want to attach an event listener with <code>document.addEventListener</code> once you receive the Cordova '<a href="cordova_events_events.md.html#deviceready">deviceready</a>' event.</p>

<h2>
<a name="volumeupbutton_supported_platforms">Supported Platforms</a>
</h2>

<ul>
<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
</ul>
<h2>
<a name="volumeupbutton_quick_example">Quick Example</a>
</h2>

<pre class="prettyprint"><code>document.addEventListener("<a href="cordova_events_events.md.html#volumeupbutton">volumeupbutton</a>", onVolumeUpKeyDown, false);

function onVolumeUpKeyDown() {
    // Handle the volume up button
}
</code></pre>

<h2>
<a name="volumeupbutton_full_example">Full Example</a>
</h2>

<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Cordova Volume Up Button Example&lt;/title&gt;

    &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" charset="utf-8"&gt;

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.9.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `<a href="cordova_events_events.md.html#deviceready">deviceready</a>`.
    //
    function onLoad() {
        document.addEventListener("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("<a href="cordova_events_events.md.html#volumeupbutton">volumeupbutton</a>", onVolumeUpKeyDown, false);
    }

    // Handle the volume up button
    //
    function onVolumeUpKeyDown() {
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

            </div>
        </div>

        <!-- Functionality and Syntax Highlighting -->
        <script type="text/javascript" src="index.js"></script><script type="text/javascript" src="prettify/prettify.js"></script>
</body>
</html>
