Device API - now with added fun
-
Upload
andrew-fisher -
Category
Technology
-
view
3.309 -
download
0
description
Transcript of Device API - now with added fun
Demos were presented on LAN. See http://github.com/ajfisher for more
Mobile Device API -Now with added fun
@ajfisher slideshare.net/andrewjfisher
#wdyk Melbourne 31 August, 2011
Demos were presented on LAN. See http://github.com/ajfisher for more
Two new eventsDEVICEMOTIONMeasures acceleration of the device
DEVICEORIENTATIONShows the orientation of a device
Demos were presented on LAN. See http://github.com/ajfisher for more
Currently supported on:Mobile Safari
(iPhone 3Gs+ for motion, iPhone 4+ for orientation)
Mobile Firefox (Android 2.3+ only)
Chrome & Safari (Dev) on desktops that have the right hardware
Opera 11 Mobile (must enable it manually).
Demos were presented on LAN. See http://github.com/ajfisher for more
GotchasCurrent spec still draft (latest July 12, 2011)
http://bit.ly/devicespec
Data inconsistent between browsersComing library to resolve these (github.com/ajfisher)
Demos were presented on LAN. See http://github.com/ajfisher for more
Let's see some data
Demos were presented on LAN. See http://github.com/ajfisher for more
Usage - deviceorientationwindow.addEventListener("deviceorientation", update_gyro, false);
function update_gyro(e) {
// gets the gyro position
var tilt = deviceOrientation(e);
$("#xval").html(tilt.gamma);
$("#yval").html(tilt.beta);
$("#zval").html(tilt.alpha);
}
Demos were presented on LAN. See http://github.com/ajfisher for more
Usage - devicemotionwindow.addEventListener("devicemotion", update_accel,
false);function update_accel(e) { // gets the accelerometer values var a = deviceMotion(e); $("#xaccel").html(a.accelerationIncludingGravity.x); $("#yaccel").html(a.accelerationIncludingGravity.y); $("#zaccel").html(a.accelerationIncludingGravity.z);}
Demos were presented on LAN. See http://github.com/ajfisher for more
Applications
Demos were presented on LAN. See http://github.com/ajfisher for more
Seismographhttp://isthisanearthquake.com
Demos were presented on LAN. See http://github.com/ajfisher for more
Tank Tag
Demos were presented on LAN. See http://github.com/ajfisher for more
Mobile Device API -Now with added fun#wdyk Melbourne 31 August, 2011
@ajfisher slideshare.net/andrewjfisher