Skip to content

Instantly share code, notes, and snippets.

@philippbosch
Created June 9, 2010 09:53
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 philippbosch/431284 to your computer and use it in GitHub Desktop.
Save philippbosch/431284 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=default-width; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap Notifications</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="jqtouch/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="jqtouch/jqtouch.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js"></script>
<link rel="stylesheet" type="text/css" href="jqtouch/jqtouch.css">
<link rel="stylesheet" type="text/css" href="themes/apple/theme.css">
<link rel="stylesheet" type="text/css" href="app.css">
</head>
<body>
<div id="jqt">
<div id="home">
<div class="toolbar"><h1>Notifications</h1></div>
<ul>
<li><a href="#" id="notification-alert-regular">Regular Alert</a></li>
<li><a href="#" id="notification-alert">Alert</a></li>
<li><a href="#" id="notification-vibrate">Vibrate</a></li>
<li><a href="#" id="notification-beep">Beep</a></li>
<li><a href="#" id="notification-activity-start">Activity Start</a></li>
<li><a href="#" id="notification-activity-stop">Activity Stop</a></li>
<li><a href="#" id="notification-loading-start">Loading Start/Stop</a></li>
</ul>
</div>
</div>
</body>
</html>
var jQT = $.jQTouch();
$(document).bind('deviceready', function() {
$('#notification-alert-regular').tap(function() {
alert('Hello world!');
});
$('#notification-alert').tap(function() {
navigator.notification.alert('Hello world!', 'Title', 'Button Label');
});
$('#notification-vibrate').tap(function() {
navigator.notification.vibrate();
});
$('#notification-beep').tap(function() {
navigator.notification.beep();
});
$('#notification-activity-start').tap(function() {
navigator.notification.activityStart();
});
$('#notification-activity-stop').tap(function() {
navigator.notification.activityStop();
});
$('#notification-loading-start').tap(function() {
navigator.notification.loadingStart();
window.setTimeout(function() {
navigator.notification.loadingStop();
}, 3000);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment