Skip to content

Instantly share code, notes, and snippets.

@jrbistuer
Last active December 15, 2015 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrbistuer/5212128 to your computer and use it in GitHub Desktop.
Save jrbistuer/5212128 to your computer and use it in GitHub Desktop.
This is a Phonegap Listener to a Native Mobile Event
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, width=device-width, target-densitydpi=device-dpi" />
<title>Pausing an application</title>
<script type="text/javascript" src="cordova-2.5.0.js"></script>
<script type="text/javascript">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("pause", onPause, false);
}
function onPause() {
//Vibration time in miliseconds
navigator.notification.vibrate(2000);
}
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment