added SMS receive functionality

This commit is contained in:
rnvahey@gmail.com
2009-02-24 22:45:42 +07:00
parent 294694ef5d
commit 4993c1bf87
29 changed files with 161 additions and 28 deletions
+20 -12
View File
@@ -4,7 +4,7 @@
* website: http://phonegap.com
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* Software), to deal in the Software without restriction, including
* Software), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
@@ -13,7 +13,7 @@
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
@@ -284,16 +284,24 @@ var Device = {
return Device.exec("vibrate")
},
playSound: function(clip) {
xsound = "sound:";
if (Device.whatPlatform == "Android") {
xsound = "playSound";
return Device.exec(xsound + clip);
}
return Device.exec(xsound + clip);
}
playSound: function(clip) {
xsound = "sound:";
if (Device.whatPlatform == "Android") {
xsound = "playSound";
return Device.exec(xsound + clip);
}
return Device.exec(xsound + clip);
},
// notifications
notification: {
watchPosition: function(filter) {
window.DroidGap.notificationWatchPosition(filter);
},
clearWatch: function(filter) {
window.DroidGap.notificationClearWatch(filter);
}
}
}
function gotLocation(lat, lon) {
+42 -4
View File
@@ -15,11 +15,11 @@
initGap = function() {
// Device.init() initializes OS-Device values
Device.init();
// UNDO Device.init();
// Device.Location.init() to initalize location
Device.Location.init();
// UNDO Device.Location.init();
//Device.Acceleration.callback = updateAccel;
}
@@ -86,7 +86,24 @@ updateAccel = function(){
}
addLoadEvent(initGap);
receiveSmsNotification = function(func)
{
if (func == 'watchPosition') {
Device.notification.watchPosition('SMS');
} else
if (func == 'clearWatch') {
Device.notification.clearWatch('SMS');
}
}
function onReceiveSms(number, message)
{
$('number').value = number;
$('message').value = message
}
// UNDO addLoadEvent(initGap);
</script>
</head><body orient="landscape">
@@ -105,6 +122,7 @@ addLoadEvent(initGap);
<li><a href="#vibration" onclick="Device.vibrate();">Vibration</a></li>
<li><a href="#vibration" onclick="Device.playSound('on.mp3")">Play Sound</a></li>
<li><a href="#photo" onclick="Device.Image.getFromPhotoLibrary();">Photo...</a></li>
<li><a href="#notification" onclick="notification();">Notification...</a></li>
<li><a href="http://phonegap.com/" target="_self">About</a></li>
</ul>
@@ -218,6 +236,26 @@ addLoadEvent(initGap);
</fieldset>
</div>
<div id="notification" title="notification" class="panel">
<h2>Notification</h2>
<fieldset>
<div class="row">
<a class="button leftButton" type="submit" onclick="receiveSmsNotification('watchPosition');">startSmsListener</a>
<a class="button blueButton" type="submit" onclick="receiveSmsNotification('clearWatch');">stopSmsListener</a>
</div>
</fieldset>
<fieldset>
<div class="row">
<label>from:</label>
<input disabled="enabled" id="number" type="text"></input>
</div>
</fieldset>
<fieldset>
<div class="row">
<label>message:</label>
<input disabled="enabled" id="message" type="text"></input>
</div>
</fieldset>
</div>
<div id="preloader"></div></body></html>