more changes to debug GPS

This commit is contained in:
Fred Grott 2009-01-15 07:47:16 -06:00 committed by fredgrott
parent 4cd7985448
commit fe74ca3ec7

View File

@ -24,7 +24,7 @@
try { try {
$ // Test if it is alread used $ // Test if it is already used
} catch(e) { } catch(e) {
$ = function(id){ $ = function(id){
return document.getElementById(id) return document.getElementById(id)
@ -34,8 +34,11 @@ try {
// Acceleration Handling // Acceleration Handling
var accelX = 0; var accelX = 0;
alert('accelX initially =' + accelX);
var accelY = 0; var accelY = 0;
alert('accelY initially =' + accelY);
var accelZ = 0; var accelZ = 0;
alert('accelZ initially =' + accelZ);
function gotAcceleration(x,y,z){ function gotAcceleration(x,y,z){
x = eval(x); x = eval(x);
@ -70,8 +73,7 @@ var Device = {
isIPhone: null, isIPhone: null,
isIPod: null, isIPod: null,
isAndroid: null, isAndroid: null,
isSymbian: null,
isBlackberry: null,
whatPlatform: "", whatPlatform: "",
osversion: "", osversion: "",
sdkfwversion: "", sdkfwversion: "",
@ -83,6 +85,9 @@ var Device = {
FNUUID: "", FNUUID: "",
FNGapVersion: "", FNGapVersion: "",
init: function(model, version) { init: function(model, version) {
@ -97,29 +102,29 @@ var Device = {
// to their AppTitle // to their AppTitle
// yes the hack sucks..but its working at this point so.. // yes the hack sucks..but its working at this point so..
alert('window.DroidGap=' + window.DroidGap);
alert('window.IPhoneGap=' + window.IPhoneGap);
alert('window.IPodGap=' + window.IPodGap);
if (window.DroidGap) if (window.DroidGap)
{ {
Device.whatPlatform = "Android"; Device.whatPlatform = "Android";
alert('Device.whatPlatform=' + Device.whatPlatform);
Device.model = window.DroidGap.getModel(); Device.model = window.DroidGap.getModel();
alert('Device.model=' + Device.model);
Device.version = window.DroidGap.getProductName(); Device.version = window.DroidGap.getProductName();
alert('Device.version=' + Device.version);
Device.osversion = window.DroidGap.getOSVersion(); Device.osversion = window.DroidGap.getOSVersion();
alert('Device.osversion=' + Device.osversion);
Device.sdkfwversion = window.DroidGap.getSDKVersion(); Device.sdkfwversion = window.DroidGap.getSDKVersion();
alert('Device.sdkfwversion=' + Device.sdkfwversion);
Device.available = true; Device.available = true;
alert('Device.available=' + Device.available);
Device.uuid = window.DroidGap.getUuid(); Device.uuid = window.DroidGap.getUuid();
alert('Device.uuid=' + Device.uuid);
Device.gapVersion = window.DroidGap.getVersion(); Device.gapVersion = window.DroidGap.getVersion();
alert('Device.gapVersion=' + Device.gapVersion);
} } else if (window.IPhoneGap)
if (window.IPhoneGap)
{ {
Device.whatPlatform = "IPhone"; Device.whatPlatform = "IPhone";
@ -137,8 +142,7 @@ var Device = {
Device.gapVersion = window.IPhoneGap.getVersion(); Device.gapVersion = window.IPhoneGap.getVersion();
} }else if (window.IPodGap)
if (window.IPodGap)
{ {
Device.whatPlatform = "IPod"; Device.whatPlatform = "IPod";
@ -156,8 +160,7 @@ var Device = {
Device.gapVersion = window.IPoddGap.getVersion(); Device.gapVersion = window.IPoddGap.getVersion();
} } else
if (!window.DroidGap || !window.IPhoneGap || !window.IPodGap )
{ {
Device.available = "__gap"; Device.available = "__gap";
Device.model = "__gap_device_model"; Device.model = "__gap_device_model";
@ -193,9 +196,9 @@ var Device = {
alert("Error executing command '" + command + "'.") alert("Error executing command '" + command + "'.")
} }
} }
if (Device.available || Device.whatPlatform == "Android") { if (Device.available || Device.whatPlatform == "Android" || command == "getloc") {
try { try {
document.location = "javascript:" + "window.DroidGap." + command + "()"; document.location = "javascript:" + "window.DroidGap.getLocation()";
alert('document.location=' + document.location); alert('document.location=' + document.location);
} catch(e) { } catch(e) {
console.log("Command '" + command + "' has not been executed, because of exception: " + e); console.log("Command '" + command + "' has not been executed, because of exception: " + e);