<commit_before>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bridge - Documentation</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
	<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="css/style.css" rel="stylesheet">
	
	<link href="css/prettify.css" type="text/css" rel="stylesheet" />
	<link href="css/desert.css" type="text/css" rel="stylesheet" />
	
	<script type="text/javascript" src="js/prettify.js"></script>
	
    <style>
		<!-- nothing here for right now -->
    </style>
    <!--<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">-->

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="images/favicon.ico">
    <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
  </head>

  <body onload="prettyPrint()">

    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="index.html">BRIDGE</a>
          <div class="nav-collapse">
            <ul class="nav">
              <li><a href="index.html">Home</a></li>
              <!--<li><a href="#about">About</a></li>-->
			  <li class="active"><a href="#">Documentation</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>
	
	<div id="docs" class="container main_container">
		<a id="fork_banner" href="https://github.com/bridgejs/bridgejs"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 9001;" src="https://a248.e.akamai.net/assets.github.com/img/4c7dc970b89fd04b81c8e221ba88ff99a06c6b61/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub"></a>
		<div class="span12">
			<div class="row">
				<!-- begin sidebar navigation -->
				<div id="docs_sidenav" class="span3 fixed">
					<div class="well sidebar-nav">
						<ul class="nav nav-list">
							<li class="nav-header">Getting Started</li>
							<li><a href="#section_1">Warning</a></li>
							<li><a href="#section_2">Core</a></li>
							<li><a href="#section_3">Accelerometer</a></li>
							<li><a href="#section_4">Device</a></li>
							<li><a href="#section_5">Geolocation</a></li>
							<li><a href="#section_6">Button</a></li>
                            <li><a href="#section_7">Compass</a></li>					
							<li><a href="#section_8">Writing Plugins</a></li>					
						</ul>
					</div>
				</div>
				<!--end sidebar navigation -->
				
				<div class="span9 offset3">
					<div class="page_header">
						<h1>Documentation</h1>
					</div>
					<section id="section_1">
                        <h2>Warning</h2>
                        <p>bridgeJS APIs are currently <i>experimental</i> and subject to change</p>
                    </section>

					<section id="section_2">
						<h2>Core</h2>
                        <p>Link to the script from bridgejs or download it <a href="http://bridgejs.com/bridge.js">here</a>
<pre class="prettyprint lang-html">
&lt;script&gt; src="http://bridgejs.com/bridge.js" &lt;/script&gt;
</pre>
                        
						<p>In order to use any native specific features in bridgeJS, you have two options: </p>
						<h4>bridge.android.recommendNative()</h4>
                        <p>Spawn a confirm box, on "yes" redirect user to PhoneBridge</p>
<pre class="prettyprint lang-js">
bridge.android.recommendNative();

if (bridge.android.browserIsBridge()) {
    // user is running the HTML5 page in a non-bridge browser
}
else {
    //user is running the HTML5 page in PhoneBridge
}
</pre>
						<h4>bridge.android.requireNative()</h4>
                        <p>If your application depends on some of the features only available to PhoneBridge call:</p>
<pre class="prettyprint lang-js">
bridge.android.requireNative();
//crucial bridge native API calls
</pre>
						<h4>bridge.android.browserIsBridge()</h4>
                        <p>Returns true if browser is bridge, false otherwise</p>
<pre class="prettyprint lang-js">
if (bridge.android.browserIsBridge()) {
    // user is running the HTML5 page in a non-bridge browser
}
else {
    //user is running the HTML5 page in PhoneBridge
}
</pre>
					</section>

					<section id="section_3">
						<h2>Accelerometer</h2>
						<p>This plugin will fail safely through to Webkit's native HTML5 implementation, if the user is not running PhoneBridge</p>
                        <h4>Acceleration object</h4>
<pre class="prettyprint lang-js">
acceleration.x; //acceleration in the x direction
acceleration.y; //acceleration in the y direction
acceleration.z; //acceleration in the z direction
acceleration.timestamp; //the time recorded by the device the moment the data was recorded
</pre>
						<h4>bridge.accelerometer.getCurrentAcceleration(onSuccess, onError)</h4>
						<p>Get the current acceleration of the device, on success call onSuccess(acceleration) once and on an error call onError() once</p>
<pre class="prettyprint lang-js">
function onSuccess(acceleration) {
    console.log("Success: x:" + acceleration.x + ", y:" + 
                    acceleration.y + ", z:" + acceleration.z +  "at"  + timestamp);
};
function onError() {
    console.log("Error");
};
bridge.accelerometer.getCurrentAcceleration(onSuccess, onError);
</pre>
						<h4>bridge.accelerometer.watchAcceleration(onSuccess, onError)</h4>
                        <p>Watch the change of acceleration on the device, on each success call onSuccess(acceleration) and on each error call OnError() </p>
<pre class="prettyprint lang-js">
function onSuccess(acceleration) {
    console.log("Success again: x:" + acceleration.x + ", y:" + 
                    acceleration.y + ", z:" + acceleration.z + " at " + timestamp);
};
function onError() {
    console.log("Error");
};
bridge.accelerometer.watchCurrentAcceleration(onSuccess, onError);
</pre>
					</section>
					
					<section id="section_4">
						<h2>Device</h2>
                        <p>This plugin will NOT safely use Webkit's HTML5 implementation of device. Device will be undefined in all browsers except PhoneBridge and PhoneGap. The device object is loaded before the page renders.</p>						
                        <h4>Device object</h4>
<pre class="prettyprint lang-js">
device.name; //the device model name
device.phonegap; //PhoneGap version (will always return -1 in PhoneBridge
device.bridge; //the current version of bridge
device.platform; //the platform (Android, etc) that bridgeJS is running on
device.uuid; //a UUID attached to every Android device
device.version; //The current build version of the Android SDK
</pre>
					</section>
					
					<section id="section_5">
						<h2>Geolocation</h2>
                        <p>This plugin will NOT safely use Webkit's HTML5 implementation of geolocation. This documentation applies only to these API calls running in PhoneBridge </p>
                        <h4>Position and Coords objects</h4>
<pre class="prettyprint lang-js">
position.coords.latitude = latitude; //The lattitude of the device
position.coords.longitude = longitude; //The longitude of the device
position.coords.accuracy = accuracy; //The accuracy in meters of the measurement
                                        //(60 means within 60 meters of given coordinates)
position.coords.altitude = altitude; //The altitude of the measurement
position.coords.bearing = bearing; //The bearing of the measurement
position.coords.provider = provider; //The provider, a string (usually gps)
position.coords.speed = speed; //The speed of the device
position.coords.time = time; //The time as recorded by the internal location listener API

position.timestamp = timestamp; //The time as recorded by the plugin
</pre>
                        <h4>bridge.geolocation.getCurrentPosition(onSuccess, onError)</h4>
                        <p>Try to get the current position of the device and enable the location service if it is not enabled already. onSuccess(position) will return within 10 seconds (if there is no GPS satellite in range before 10 seconds pass call onError()). If the user's screen turns off before this call returns no callback will occur</p>
<pre class="prettyprint lang-js">
function onSuccess(position) {
    console.log("Success! I'm at Lat:" + position.coords.latitude + 
                        ", Long:" + position.coords.longitude);
};
function onError() {
    console.log("Error");
};
bridge.geolocation.getCurrentPosition(onSuccess, onError);
</pre>
                        <h4>bridge.geolocation.isEnabled()</h4>
                        <p>Return true if the location service is enabled, false otherwise</p>
<pre class="prettyprint lang-js">
if(bridge.geolocation.isEnabled()) {
    console.log("The location service is enabled"); //the battery will drain fast!
}
else {
    console.log("The location service is not enabled"); //the battery will not drain too fast
}
</pre>

                        <h4>bridge.geolocation.enableLocationService()</h4>
                        <p>Enable the location service (this may take a few seconds to fully enable). Note: battery will drain significantly faster than if location service is off</p>
<pre class="prettyprint lang-js">
//location service is off
bridge.geolocation.enableLocationService();
//location service is on
</pre>

                        <h4>bridge.geolocation.disableLocationService()</h4>
                        <p>Disable the location service (this may take a few seconds to fully disable). Note: it is wise to disable the location service when you don't need to access the user's location as this saves battery</p>
<pre class="prettyprint lang-js">
//onSuccess, onError defined up here
bridge.getCurrentPosition(onSuccess, onError);

//some code that relys on a lot of getCurrentPosition calls

function doneWithLocationService() {
   bridge.geolocation.disableLocationService(); //save the battery
}
</pre>
					</section>
					
					<section id="section_6">
						<h2>Button</h2>
						<p>All these methods are very similar -- if you are confused after reading only one function description read the other examples as well. Only use functions within this plugin when you are sure the user is running on Android and with PhoneBridge.</p>

                        <h4>bridge.android.on.backButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the back button on the Android device. Call with `isSuper` set to false to completely override the default behavior. Call with `isSuper` set to true to execute Android's default behavior <i>concurrently</i> with your callback</p>
<pre class="prettyprint lang-js">
bridge.android.on.backButton(false, function() {
    console.log("Are you sure you want to quit?");
});
//the next press of the back button will implement the default behavior
//behavior of the back button press
</pre>
                        <h4>bridge.android.on.volumedownButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the volumedown button on the Android device. Call with `isSuper` set to false to completely override the default behavior. Call with `isSuper` set to true to execute Android's default behavior <i>concurrently</i> with your callback</p>
<pre class="prettyprint lang-js">
bridge.android.on.volumedownButton(true, function() {
    console.log("You just lowered the volume in my game!");
});
//the console.log will execute concurrently with the system handling 
//the button press
</pre>
                        <h4>bridge.android.on.volumeupButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the volumeup button on the Android device. Call with `isSuper` set to false to completely override the default behavior. Call with `isSuper` set to true to execute Android's default behavior <i>concurrently</i> with your callback</p>
<pre class="prettyprint lang-js">
bridge.android.on.volumeupButton(false, function() {
    moveTheRocketUp();
});
</pre>
                        <h4>bridge.android.on.menuButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the menu button on the Android device. Call with `isSuper` set to false to completely override the default behavior. Call with `isSuper` set to true to execute Android's default behavior <i>concurrently</i> with your callback</p>
<pre class="prettyprint lang-js">
bridge.android.on.menuButton(false, function() {
    person.jump();
});
</pre>
                        <h4>bridge.android.on.homeButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the home button on the Android device. Due to limitations in the native Android API, there is no way to override the default behavior of the home button. <i>Setting `isSuper` does absolutely nothing</i> it is just kept as a parameter to keep consistency with the other functions in the `on` object.
<pre class="prettyprint lang-js">
bridge.android.on.homeButton(false, function() {
    console.log("I have to execute concurrently with the system");
});
</pre>
					</section>

                    <section id="section_7">
                        <h2>Compass</h2>
                        <p>The plugin will NOT safely use Webkit's HTML5 implementation of orientation tracking. This document applies only to API calls running in PhoneBridge </p>

                        <h4> Orientation Object </h4>
 <pre class="prettyprint lang-js">
//compass like 2-d orientation where 0 = North, 90 = East, etc 
orientation.azimuth;
//side to side orientation where vertical is 0, left is 90, and right is -90
orientation.pitch;
//degree to which the device is tilted backwards or forwards 
orientation.roll;
</pre>
                        <h4> bridge.orientation.getCurrentOrientation(onSuccess,onError)</h4>
                        <p> Get the current orientation of the device. On success call onSuccess(orientation) once and on error call onError() once.<p>

                    </section>
 <pre class="prettyprint lang-js">
function onSuccess(compass){
    console.log("Success: azimuth: " + compass.azimuth + ", pitch: " + 
      compass.pitch + ", roll: " + compass.roll + "at" + compass.timestamp);
};
function onError(){
    console.log("Error");
};
bridge.orientation.getCurrentOrientation(onSuccess,onError);

</pre>
                    <section id="section_8">
						<h2>Writing Plugins</h2>
						<p>TODO</p>
					
					<div class="clear"></div>
					
				</div>
			</div>
		</div>
	</div>

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="../assets/js/jquery.js"></script>
    <script src="../assets/js/bootstrap-transition.js"></script>
    <script src="../assets/js/bootstrap-alert.js"></script>
    <script src="../assets/js/bootstrap-modal.js"></script>
    <script src="../assets/js/bootstrap-dropdown.js"></script>
    <script src="../assets/js/bootstrap-scrollspy.js"></script>
    <script src="../assets/js/bootstrap-tab.js"></script>
    <script src="../assets/js/bootstrap-tooltip.js"></script>
    <script src="../assets/js/bootstrap-popover.js"></script>
    <script src="../assets/js/bootstrap-button.js"></script>
    <script src="../assets/js/bootstrap-collapse.js"></script>
    <script src="../assets/js/bootstrap-carousel.js"></script>
    <script src="../assets/js/bootstrap-typeahead.js"></script>

  </body>
</html>
<commit_msg>Fixed whitespace<commit_after>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bridge - Documentation</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
	<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="css/style.css" rel="stylesheet">
	
	<link href="css/prettify.css" type="text/css" rel="stylesheet" />
	<link href="css/desert.css" type="text/css" rel="stylesheet" />
	
	<script type="text/javascript" src="js/prettify.js"></script>
	
    <style>
		<!-- nothing here for right now -->
    </style>
    <!--<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">-->

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="images/favicon.ico">
    <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
  </head>

  <body onload="prettyPrint()">

    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="index.html">BRIDGE</a>
          <div class="nav-collapse">
            <ul class="nav">
              <li><a href="index.html">Home</a></li>
              <!--<li><a href="#about">About</a></li>-->
			  <li class="active"><a href="#">Documentation</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>
	
	<div id="docs" class="container main_container">
		<a id="fork_banner" href="https://github.com/bridgejs/bridgejs"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 9001;" src="https://a248.e.akamai.net/assets.github.com/img/4c7dc970b89fd04b81c8e221ba88ff99a06c6b61/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub"></a>
		<div class="span12">
			<div class="row">
				<!-- begin sidebar navigation -->
				<div id="docs_sidenav" class="span3 fixed">
					<div class="well sidebar-nav">
						<ul class="nav nav-list">
							<li class="nav-header">Getting Started</li>
							<li><a href="#section_1">Warning</a></li>
							<li><a href="#section_2">Core</a></li>
							<li><a href="#section_3">Accelerometer</a></li>
							<li><a href="#section_4">Device</a></li>
							<li><a href="#section_5">Geolocation</a></li>
							<li><a href="#section_6">Button</a></li>
                            				<li><a href="#section_7">Compass</a></li>					
							<li><a href="#section_8">Writing Plugins</a></li>					
						</ul>
					</div>
				</div>
				<!--end sidebar navigation -->
				
				<div class="span9 offset3">
					<div class="page_header">
						<h1>Documentation</h1>
					</div>
					<section id="section_1">
                        <h2>Warning</h2>
                        <p>bridgeJS APIs are currently <i>experimental</i> and subject to change</p>
                    </section>

					<section id="section_2">
						<h2>Core</h2>
                        <p>Link to the script from bridgejs or download it <a href="http://bridgejs.com/bridge.js">here</a>
<pre class="prettyprint lang-html">
&lt;script&gt; src="http://bridgejs.com/bridge.js" &lt;/script&gt;
</pre>
                        
						<p>In order to use any native specific features in bridgeJS, you have two options: </p>
						<h4>bridge.android.recommendNative()</h4>
                        <p>Spawn a confirm box, on "yes" redirect user to PhoneBridge</p>
<pre class="prettyprint lang-js">
bridge.android.recommendNative();

if (bridge.android.browserIsBridge()) {
    // user is running the HTML5 page in a non-bridge browser
}
else {
    //user is running the HTML5 page in PhoneBridge
}
</pre>
						<h4>bridge.android.requireNative()</h4>
                        <p>If your application depends on some of the features only available to PhoneBridge call:</p>
<pre class="prettyprint lang-js">
bridge.android.requireNative();
//crucial bridge native API calls
</pre>
						<h4>bridge.android.browserIsBridge()</h4>
                        <p>Returns true if browser is bridge, false otherwise</p>
<pre class="prettyprint lang-js">
if (bridge.android.browserIsBridge()) {
    // user is running the HTML5 page in a non-bridge browser
}
else {
    //user is running the HTML5 page in PhoneBridge
}
</pre>
					</section>

					<section id="section_3">
						<h2>Accelerometer</h2>
						<p>This plugin will fail safely through to Webkit's native HTML5 implementation, if the user is not running PhoneBridge</p>
                        <h4>Acceleration object</h4>
<pre class="prettyprint lang-js">
acceleration.x; //acceleration in the x direction
acceleration.y; //acceleration in the y direction
acceleration.z; //acceleration in the z direction
acceleration.timestamp; //the time recorded by the device the moment the data was recorded
</pre>
						<h4>bridge.accelerometer.getCurrentAcceleration(onSuccess, onError)</h4>
						<p>Get the current acceleration of the device, on success call onSuccess(acceleration) once and on an error call onError() once</p>
<pre class="prettyprint lang-js">
function onSuccess(acceleration) {
    console.log("Success: x:" + acceleration.x + ", y:" + 
                    acceleration.y + ", z:" + acceleration.z +  "at"  + timestamp);
};
function onError() {
    console.log("Error");
};
bridge.accelerometer.getCurrentAcceleration(onSuccess, onError);
</pre>
						<h4>bridge.accelerometer.watchAcceleration(onSuccess, onError)</h4>
                        <p>Watch the change of acceleration on the device, on each success call onSuccess(acceleration) and on each error call OnError() </p>
<pre class="prettyprint lang-js">
function onSuccess(acceleration) {
    console.log("Success again: x:" + acceleration.x + ", y:" + 
                    acceleration.y + ", z:" + acceleration.z + " at " + timestamp);
};
function onError() {
    console.log("Error");
};
bridge.accelerometer.watchCurrentAcceleration(onSuccess, onError);
</pre>
					</section>
					
					<section id="section_4">
						<h2>Device</h2>
                        <p>This plugin will NOT safely use Webkit's HTML5 implementation of device. Device will be undefined in all browsers except PhoneBridge and PhoneGap. The device object is loaded before the page renders.</p>						
                        <h4>Device object</h4>
<pre class="prettyprint lang-js">
device.name; //the device model name
device.phonegap; //PhoneGap version (will always return -1 in PhoneBridge
device.bridge; //the current version of bridge
device.platform; //the platform (Android, etc) that bridgeJS is running on
device.uuid; //a UUID attached to every Android device
device.version; //The current build version of the Android SDK
</pre>
					</section>
					
					<section id="section_5">
						<h2>Geolocation</h2>
                        <p>This plugin will NOT safely use Webkit's HTML5 implementation of geolocation. This documentation applies only to these API calls running in PhoneBridge </p>
                        <h4>Position and Coords objects</h4>
<pre class="prettyprint lang-js">
position.coords.latitude = latitude; //The lattitude of the device
position.coords.longitude = longitude; //The longitude of the device
position.coords.accuracy = accuracy; //The accuracy in meters of the measurement
                                        //(60 means within 60 meters of given coordinates)
position.coords.altitude = altitude; //The altitude of the measurement
position.coords.bearing = bearing; //The bearing of the measurement
position.coords.provider = provider; //The provider, a string (usually gps)
position.coords.speed = speed; //The speed of the device
position.coords.time = time; //The time as recorded by the internal location listener API

position.timestamp = timestamp; //The time as recorded by the plugin
</pre>
                        <h4>bridge.geolocation.getCurrentPosition(onSuccess, onError)</h4>
                        <p>Try to get the current position of the device and enable the location service if it is not enabled already. onSuccess(position) will return within 10 seconds (if there is no GPS satellite in range before 10 seconds pass call onError()). If the user's screen turns off before this call returns no callback will occur</p>
<pre class="prettyprint lang-js">
function onSuccess(position) {
    console.log("Success! I'm at Lat:" + position.coords.latitude + 
                        ", Long:" + position.coords.longitude);
};
function onError() {
    console.log("Error");
};
bridge.geolocation.getCurrentPosition(onSuccess, onError);
</pre>
                        <h4>bridge.geolocation.isEnabled()</h4>
                        <p>Return true if the location service is enabled, false otherwise</p>
<pre class="prettyprint lang-js">
if(bridge.geolocation.isEnabled()) {
    console.log("The location service is enabled"); //the battery will drain fast!
}
else {
    console.log("The location service is not enabled"); //the battery will not drain too fast
}
</pre>

                        <h4>bridge.geolocation.enableLocationService()</h4>
                        <p>Enable the location service (this may take a few seconds to fully enable). Note: battery will drain significantly faster than if location service is off</p>
<pre class="prettyprint lang-js">
//location service is off
bridge.geolocation.enableLocationService();
//location service is on
</pre>

                        <h4>bridge.geolocation.disableLocationService()</h4>
                        <p>Disable the location service (this may take a few seconds to fully disable). Note: it is wise to disable the location service when you don't need to access the user's location as this saves battery</p>
<pre class="prettyprint lang-js">
//onSuccess, onError defined up here
bridge.getCurrentPosition(onSuccess, onError);

//some code that relys on a lot of getCurrentPosition calls

function doneWithLocationService() {
   bridge.geolocation.disableLocationService(); //save the battery
}
</pre>
					</section>
					
					<section id="section_6">
						<h2>Button</h2>
						<p>All these methods are very similar -- if you are confused after reading only one function description read the other examples as well. Only use functions within this plugin when you are sure the user is running on Android and with PhoneBridge.</p>

                        <h4>bridge.android.on.backButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the back button on the Android device. Call with `isSuper` set to false to completely override the default behavior. Call with `isSuper` set to true to execute Android's default behavior <i>concurrently</i> with your callback</p>
<pre class="prettyprint lang-js">
bridge.android.on.backButton(false, function() {
    console.log("Are you sure you want to quit?");
});
//the next press of the back button will implement the default behavior
//behavior of the back button press
</pre>
                        <h4>bridge.android.on.volumedownButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the volumedown button on the Android device. Call with `isSuper` set to false to completely override the default behavior. Call with `isSuper` set to true to execute Android's default behavior <i>concurrently</i> with your callback</p>
<pre class="prettyprint lang-js">
bridge.android.on.volumedownButton(true, function() {
    console.log("You just lowered the volume in my game!");
});
//the console.log will execute concurrently with the system handling 
//the button press
</pre>
                        <h4>bridge.android.on.volumeupButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the volumeup button on the Android device. Call with `isSuper` set to false to completely override the default behavior. Call with `isSuper` set to true to execute Android's default behavior <i>concurrently</i> with your callback</p>
<pre class="prettyprint lang-js">
bridge.android.on.volumeupButton(false, function() {
    moveTheRocketUp();
});
</pre>
                        <h4>bridge.android.on.menuButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the menu button on the Android device. Call with `isSuper` set to false to completely override the default behavior. Call with `isSuper` set to true to execute Android's default behavior <i>concurrently</i> with your callback</p>
<pre class="prettyprint lang-js">
bridge.android.on.menuButton(false, function() {
    person.jump();
});
</pre>
                        <h4>bridge.android.on.homeButton(isSuper, callback)</h4>
                        <p>Register a callback function that will be called for the <i>next</i> time the user presses the home button on the Android device. Due to limitations in the native Android API, there is no way to override the default behavior of the home button. <i>Setting `isSuper` does absolutely nothing</i> it is just kept as a parameter to keep consistency with the other functions in the `on` object.
<pre class="prettyprint lang-js">
bridge.android.on.homeButton(false, function() {
    console.log("I have to execute concurrently with the system");
});
</pre>
					</section>

                    <section id="section_7">
                        <h2>Compass</h2>
                        <p>The plugin will NOT safely use Webkit's HTML5 implementation of orientation tracking. This document applies only to API calls running in PhoneBridge </p>

                        <h4> Orientation Object </h4>
 <pre class="prettyprint lang-js">
//compass like 2-d orientation where 0 = North, 90 = East, etc 
orientation.azimuth;
//side to side orientation where vertical is 0, left is 90, and right is -90
orientation.pitch;
//degree to which the device is tilted backwards or forwards 
orientation.roll;
</pre>
                        <h4> bridge.orientation.getCurrentOrientation(onSuccess,onError)</h4>
                        <p> Get the current orientation of the device. On success call onSuccess(orientation) once and on error call onError() once.<p>

                    </section>
 <pre class="prettyprint lang-js">
function onSuccess(compass){
    console.log("Success: azimuth: " + compass.azimuth + ", pitch: " + 
      compass.pitch + ", roll: " + compass.roll + "at" + compass.timestamp);
};
function onError(){
    console.log("Error");
};
bridge.orientation.getCurrentOrientation(onSuccess,onError);

</pre>
                    <section id="section_8">
						<h2>Writing Plugins</h2>
						<p>TODO</p>
					
					<div class="clear"></div>
					
				</div>
			</div>
		</div>
	</div>

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="../assets/js/jquery.js"></script>
    <script src="../assets/js/bootstrap-transition.js"></script>
    <script src="../assets/js/bootstrap-alert.js"></script>
    <script src="../assets/js/bootstrap-modal.js"></script>
    <script src="../assets/js/bootstrap-dropdown.js"></script>
    <script src="../assets/js/bootstrap-scrollspy.js"></script>
    <script src="../assets/js/bootstrap-tab.js"></script>
    <script src="../assets/js/bootstrap-tooltip.js"></script>
    <script src="../assets/js/bootstrap-popover.js"></script>
    <script src="../assets/js/bootstrap-button.js"></script>
    <script src="../assets/js/bootstrap-collapse.js"></script>
    <script src="../assets/js/bootstrap-carousel.js"></script>
    <script src="../assets/js/bootstrap-typeahead.js"></script>

  </body>
</html>

{'fraction_non_alphanumeric': 0.13458123927894308, 'fraction_numerical': 0.01679256071503807, 'mean_word_length': 3.0298326461314575, 'pattern_counts': {'":': 0, '<': 675, '<?xml version=': 0, '>': 675, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4960046', 'n_tokens_mistral': 10511, 'n_tokens_neox': 9280, 'n_words': 2957}