Weinre: troubleshoot mobile and remote apps

1) Install it if you haven’t yet: $npm install weinre -g 2) run it: $ weinre -boundHost [your ip address here or localhost] 3) Put the following reference in the page you are trying to troubleshoot: <script src=”http//[the ip address you entered]:8080/target/target-script.js#anonymous”></script> 4) Point your browser to the ip address you entered, that will give […]

phonegap: camera in javascript! code

function testCamera() { clearPhoto(); navigator.camera.getPicture(camSuccess, allError, { quality: 50 }); } function camSuccess(imageData) { var image = document.querySelector(‘#hello_world’); image.src = “data:image/jpeg;base64,” + imageData; } function clearPhoto() { var image = document.querySelector(‘#hello_world’); image.src = “”; }

phonegap: accelerometer code

function testAccel() { navigator.accelerometer.getCurrentAcceleration(accelSuccess, allError); } function accelSuccess(acceleration) { var element = document.getElementById(‘accel’); element.innerHTML = ‘Acceleration X: ‘ + acceleration.x + ‘<br />’ + ‘Acceleration Y: ‘ + acceleration.y + ‘<br />’ + ‘Acceleration Z: ‘ + acceleration.z + ‘<br />’ + ‘Timestamp: ‘ + acceleration.timestamp + ‘<br />’; }

phonegap: geolocation code

navigator.geolocation.getCurrentPosition(geoSuccess, allError); function geoSuccess(position) { var element = document.getElementById(‘geoApi’); element.innerHTML = ‘Getting ready to print the data’; element.innerHTML = ‘Latitude: ‘ + position.coords.latitude + ‘<br />’ + ‘Longitude: ‘ + position.coords.longitude + ‘<br />’ + ‘Altitude: ‘ + position.coords.altitude + ‘<br />’ + ‘Accuracy: ‘ + position.coords.accuracy + ‘<br />’ + ‘Altitude Accuracy: ‘ + […]