Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

debugging post

  • Loading branch information...
commit 0d910ec12151f9a365f41ba0f58b1f0f21dcb8e7 1 parent 8920b24
hutley authored
12,493 HelloPhoneGap.xcodeproj/project.xcworkspace/xcuserdata/hiedi.xcuserdatad/UserInterfaceState.xcuserstate
View
10,529 additions, 1,964 deletions not shown
61 www/PhoneGapShim1.js
View
@@ -0,0 +1,61 @@
+//from Jesse McFayden, Nitobi Inc
+//https://gist.github.com/raw/476358/dae649dc8d7b20041780bc6a2bcfcb9f31dbcdfe/pgDebug.js
+var safariDebug = (navigator.platform.indexOf("iPhone") < 0 && navigator.platform.indexOf("iPod") < 0 && navigator.platform.indexOf("iPad") < 0);
+
+if (safariDebug)
+{
+
+ PhoneGap.run_command = function()
+ {
+ if (!PhoneGap.available || !PhoneGap.queue.ready)
+ {
+ return;
+ }
+
+ PhoneGap.queue.ready = false;
+
+ var args = PhoneGap.queue.commands.shift();
+ if (PhoneGap.queue.commands.length == 0) {
+ clearInterval(PhoneGap.queue.timer);
+ PhoneGap.queue.timer = null;
+ }
+
+ var uri = [];
+ var dict = null;
+ for (var i = 1; i < args.length; i++) {
+ var arg = args[i];
+ if (arg == undefined || arg == null)
+ arg = '';
+ if (typeof(arg) == 'object')
+ dict = arg;
+ else
+ uri.push(encodeURIComponent(arg));
+ }
+ var url = "gap://" + args[0] + "/" + uri.join("/");
+ if (dict != null) {
+ var query_args = [];
+ for (var name in dict) {
+ if (typeof(name) != 'string')
+ continue;
+ query_args.push(encodeURIComponent(name) + "=" + encodeURIComponent(dict[name]));
+ }
+ if (query_args.length > 0)
+ url += "?" + query_args.join("&");
+ }
+ alert(url);
+ //console.log(url);
+ setTimeout(function() {
+ PhoneGap.queue.ready = true;
+ },
+ 10);
+ // so the next one can go
+ };
+
+ setTimeout(function() {
+ DeviceInfo.uuid = "testing";
+ },
+ 2000);
+
+ alert("here2");
+}
+
11 www/PhoneGapShim2.js
View
@@ -0,0 +1,11 @@
+function StopGap() {
+ function deviceready() {
+ // fire off deviceready
+ var e = document.createEvent('Events');
+ e.initEvent('deviceready');
+ document.dispatchEvent(e);
+ }
+
+ window.PhoneGap = {};
+ deviceready();
+}
21 www/camera.html
View
@@ -9,6 +9,7 @@
<title>HelloPhoneGap</title>
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.4.min.js"></script>
+
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
@@ -47,6 +48,7 @@
// The inline CSS rules are used to resize the image
//
myImage.src = "data:image/jpeg;base64," + imageData;
+
}
// Called when a photo is successfully retrieved
@@ -87,17 +89,28 @@
// A button will call this function
//
function capturePhotoEdit() {
+ try {
// Take picture using device camera, allow edit, and retrieve image as base64-encoded string
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 20, allowEdit: true });
- }
+ }catch (err)
+ {
+ alert(err);
+ }
+ }
// A button will call this function
//
function getPhoto(source) {
+
+ try {
// Retrieve image file location from specified source
navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,
destinationType: destinationType.FILE_URI,
sourceType: source });
+ }catch (err)
+ {
+ alert(err);
+ }
}
function onFail(mesage) {
@@ -138,12 +151,12 @@
</TR>
<TR>
<TD>
- <button onclick="getPhoto(pictureSource.PHOTOLIBRARY);">From Photo Library</button><br>
+ <button onclick="try{getPhoto(pictureSource.PHOTOLIBRARY);}catch(err){alert(err);};">From Photo Library</button><br>
</TD>
</TR>
<TR>
<TD>
- <button onclick="getPhoto(pictureSource.SAVEDPHOTOALBUM);">From Photo Album</button><br>
+ <button onclick="try{getPhoto(pictureSource.SAVEDPHOTOALBUM);}catch(err){alert(err);};">From Photo Album</button><br>
</TD>
</TR>
@@ -161,4 +174,6 @@
<DIV id="phoneGapReady" class="phoneGapReady">waiting for PhoneGap to initialize....</DIV>
</body>
+
+
</html>
124 www/debug.html
View
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <!-- Change this if you want to allow scaling -->
+ <meta name="viewport" content="width=default-width; user-scalable=no" />
+
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <link rel="stylesheet" href="HelloPhoneGap.css" type="text/css"/>
+ <title>HelloPhoneGap</title>
+
+ <script type="text/javascript" charset="utf-8" src="phonegap.0.9.4.min.js"></script>
+ <script type="text/javascript" charset="utf-8" src="PhoneGapShim1.js"></script>
+
+ <script type="text/javascript" charset="utf-8">
+
+ var pictureSource; // picture source
+ var destinationType; // sets the format of returned value
+
+
+ function onBodyLoad()
+ {
+ document.addEventListener("deviceready",onDeviceReady,false);
+ }
+
+ /* When this function is called, PhoneGap has been initialized and is ready to roll */
+ function onDeviceReady()
+ {
+ phoneGapReady.innerHTML = "PhoneGap is Ready";
+
+ }
+
+ function getDeviceProperties() {
+ var element = document.getElementById('deviceProperties');
+
+ element.innerHTML = 'Device Name: ' + device.name + '<br />' +
+ 'Device PhoneGap: ' + device.phonegap + '<br />' +
+ 'Device Platform: ' + device.platform + '<br />' +
+ 'Device UUID: ' + device.uuid + '<br />' +
+ 'Device Version: ' + device.version + '<br />';
+ }
+
+
+ </script>
+ </head>
+ <body onload="onBodyLoad()">
+
+ <DIV class="phoneGapAPITitle">
+
+ <TABLE width="100%">
+ <TR>
+ <TD>
+ Device API
+ </TD>
+ <TD align="right"><a href="index.html">back</a>
+ </TD>
+ </TR>
+
+ </TABLE>
+ </DIV>
+ <DIV class="phoneGapAPI">
+
+ <TABLE>
+ <TR>
+ <TD>
+ <button onclick="getDeviceProperties();">getDeviceProperties()</button> <br>
+ </TD>
+ </TR>
+
+
+ <TR>
+ <TD id="deviceProperties" >
+
+ </TD>
+ </TR>
+
+ </TABLE>
+ </DIV>
+ <DIV class="phoneGapAPITitle">
+
+ <TABLE width="100%">
+ <TR>
+ <TD>
+ Accelerometer API
+ </TD>
+ <TD align="right"><a href="index.html">back</a>
+ </TD>
+ </TR>
+
+ </TABLE>
+ </DIV>
+ <DIV class="phoneGapAPI">
+
+ <TABLE>
+ <TR>
+ <TD>
+ <button class="phoneGapAPIButton" onclick="getCurrentAcceleration();">getCurrentAcceleration()</button>
+ </TD>
+ </TR>
+ <TR>
+ <TD id="currentAccelerationResult">
+
+ </TD>
+ </TR>
+
+ <TR>
+ <TD>
+ <button class="phoneGapAPIButton" onclick="startWatch();">startWatch(1000ms)</button>
+ <button class="phoneGapAPIButton" onclick="stopWatch();">stopWatch()</button>
+
+ </TD>
+ </TR>
+ <TR>
+ <TD id="watchResult">
+
+ </TD>
+ </TR>
+
+ </TABLE>
+ </DIV>
+
+ <DIV id="phoneGapReady" class="phoneGapReady">waiting for PhoneGap to initialize....</DIV>
+
+ </body>
+</html>
9 www/geolocation.html
View
@@ -9,6 +9,7 @@
<title>HelloPhoneGap</title>
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.4.min.js"></script>
+
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
@@ -28,7 +29,13 @@
}
function getLocation() {
- navigator.geolocation.getCurrentPosition(onSuccess, onError);
+ try {
+ navigator.geolocation.getCurrentPosition(onSuccess, onError);
+ }
+ catch (err)
+ {
+ alert(err);
+ }
}
// onSuccess Geolocation
Please sign in to comment.
Something went wrong with that request. Please try again.