<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dougt&#039;s blog &#187; device api</title>
	<atom:link href="http://dougt.org/wordpress/tag/device-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougt.org/wordpress</link>
	<description>best. tagline. ever.</description>
	<lastBuildDate>Mon, 26 Jul 2010 03:18:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Desktop Notifications</title>
		<link>http://dougt.org/wordpress/2010/06/desktop-notifications/</link>
		<comments>http://dougt.org/wordpress/2010/06/desktop-notifications/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 06:27:44 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[fennec]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=551</guid>
		<description><![CDATA[This is a feature that may come to a browser some day.  I am interesting in your thoughts: Desktop Notifications Desktop notifications allow a web page to notify the user using system level services, such as Growl, in a clean, safe, and easy to use manner. The code is very simple: navigator.notification.notify("Another Desktop Notification", "Check [...]]]></description>
			<content:encoded><![CDATA[<p>This is a feature that may come to a browser some day.  I am interesting in your thoughts:</p>
<p><strong>Desktop Notifications</strong></p>
<p>Desktop notifications allow a web page to notify the user using system level services, such as <a href="http://growl.info/about.php">Growl</a>, in a clean, safe, and easy to use manner.</p>
<p>The code is very simple:</p>
<pre>navigator.notification.notify("Another Desktop Notification",
                              "Check out my icon",
                              "http://dougt.org/me.jpg");</pre>
<p>and the result is something you&#8217;d expect from a notification.  On the Mac, the notification may look like:</p>
<p><a href="http://dougt.org/wordpress/wp-content/uploads/Screen-shot-2010-06-21-at-3.04.56-PM.png"><img class="aligncenter size-medium wp-image-552" title="Desktop Notification example" src="http://dougt.org/wordpress/wp-content/uploads/Screen-shot-2010-06-21-at-3.04.56-PM-300x114.png" alt="" width="300" height="114" /></a></p>
<p>You can get more sophisticated by adding a callback when the user clicks on the Desktop Notification:</p>
<pre>navigator.notification.notify("Another Desktop Notification",
                              "Check out my icon",
                              "http://dougt.org/me.jpg");
                              function() { /*do something*/ });</pre>
<p>A user must grant each site permission before they can use Desktop Notifications.  We will use the familiar notification bar (the text isn&#8217;t final.  Also, these will end up looking quite different in future releases of Firefox.):</p>
<p><a href="http://dougt.org/wordpress/wp-content/uploads/Screenshot-Minefield.png"><img class="aligncenter size-medium wp-image-553" title="Infobar notification for DesktopNotifications" src="http://dougt.org/wordpress/wp-content/uploads/Screenshot-Minefield-300x62.png" alt="" width="300" height="62" /></a></p>
<p>That is there all there is to it!</p>
<p><strong>Get involved:</strong></p>
<p>If you like or dislike this feature, please just leave a comment.</p>
<p>If you like to follow the implementation details, you can follow bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=573588">573588</a>.</p>
<p>You can try out the <a href="http://ftp.mozilla.org/pub/mozilla.org/firefox/tryserver-builds/dougt@mozilla.com-a2f00cf80e96/">engineering builds</a>.  There are bound to be a few bugz.  If you see anything funky, please let me know.</p>
<p>If you are using the above engineering builds, you can try out <a href="http://people.mozilla.org/~dougt/notification.html">Desktop Notifications</a>.</p>
<p><strong>More details:</strong></p>
<p>I reviewed two draft specifications.  The first is the <a href="http://dev.w3.org/2006/webapi/WebNotifications/publish/">WebNotification</a> specification and the other is the Google Gears <a href="http://code.google.com/p/gears/wiki/NotificationAPI">NotificationAPI</a>.  I found both of these APIs more complex than what was required.  Clearly both of these other APIs have use cases that are not address by my proposal.  But for basic notification from the browser, not much is required.</p>
<p>Looking at what Growl and other system level notification services provide, you basically only need a title, a description, and an icon.  For fun, I added one callback if the user clicks on the notification while it is on screen.</p>
<p><strong>Next Steps</strong></p>
<p>You tell me.  Is this something you&#8217;d like to see in the browser?  Does the API work for your use cases?</p>
<p>Let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2010/06/desktop-notifications/feed/</wfw:commentRss>
		<slash:comments>52</slash:comments>
		</item>
		<item>
		<title>Labyrinth Game in the browser</title>
		<link>http://dougt.org/wordpress/2009/12/labyrinth-game-in-the-browser/</link>
		<comments>http://dougt.org/wordpress/2009/12/labyrinth-game-in-the-browser/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 21:18:05 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[accelerometer]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[MozOrientation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=516</guid>
		<description><![CDATA[A few months ago, I mentioned the game Labyrinth and how I wanted this to work in the browser. Syd Lawrence took up the cause and put together a cool implementation. Play it here. You must be running Firefox 3.6 RC or better. This uses the new orientation events added to Firefox 3.6. Syd also [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, I mentioned the <a href="http://dougt.org/wordpress/2009/08/orientation/">game Labyrinth</a> and how I wanted this to work in the browser.  <a href="http://twitter.com/sydlawrence">Syd Lawrence</a> took up the cause and put together a cool implementation.</p>
<p>Play it <a href="http://playground.marmaladeontoast.co.uk/labyrinth">here</a>.  You must be running Firefox 3.6 RC or better.</p>
<p>This uses the new <a href="http://hacks.mozilla.org/2009/10/orientation-for-firefox/"> orientation events added to Firefox 3.6</a>.</p>
<p>Syd also put together a demo of what orientation looks like for those that do not have Firefox 3.6:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="340" height="285" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/M5GMWaGiV1g&amp;hl=en_US&amp;fs=1&amp;border=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="340" height="285" src="http://www.youtube.com/v/M5GMWaGiV1g&amp;hl=en_US&amp;fs=1&amp;border=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>This web feature is going to be standardized in the <a href="http://www.w3.org/">W3C</a> in one of two working groups.   The general idea is to separate out acceleration (values in <a href="http://en.wikipedia.org/wiki/Standard_gravity">g</a>) and orientation (values in degrees for azimuth, roll, pitch).  More on that next year when we figure out where the work will be done!</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/12/labyrinth-game-in-the-browser/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Geolocation support in add-ons</title>
		<link>http://dougt.org/wordpress/2009/11/geolocation-support-in-add-ons/</link>
		<comments>http://dougt.org/wordpress/2009/11/geolocation-support-in-add-ons/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 21:03:19 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[geolocation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=500</guid>
		<description><![CDATA[Today, I checked-in a set of changes that will allow mozilla addons the ability to acquire the location information. It is pretty simple to do: geolocation = Cc["@mozilla.org/geolocation;1"] .getService(Ci.nsIDOMGeoGeolocation); geolocation.watchPosition(successCallback); In this trivial example, the object &#124;geolocation&#124; is fully compatible with the W3C&#8217;s geolocation object that exists under the navigator object in web content. &#124;successCallback&#124; [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I checked-in a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=493615">set of changes</a> that will allow mozilla addons the ability to acquire the location information.  It is pretty simple to do:<br />
<code><br />
geolocation = Cc["@mozilla.org/geolocation;1"]<br />
                       .getService(Ci.nsIDOMGeoGeolocation);<br />
geolocation.watchPosition(successCallback);<br />
</code></p>
<p>In this trivial example, the object |geolocation| is fully compatible with the<a href="http://www.w3.org/TR/geolocation-API/"> W3C&#8217;s geolocation</a> object that exists under the navigator object in web content.  |successCallback| will be called when Firefox acquires your position.</p>
<p>The prompting of the user is left up to your application.  All addons hosted on addons.mozilla.org must <a href="https://wiki.mozilla.org/Update:Editors/ReviewingGuide#Reviewing_Geolocation_stuff">follow the guidelines</a> and prompt the user.</p>
<p>If you have questions about what is permissible, please contact <a href="mailto:dougt@dougt.org">me</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/11/geolocation-support-in-add-ons/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Orientation Update&#8230;</title>
		<link>http://dougt.org/wordpress/2009/08/orientation-update/</link>
		<comments>http://dougt.org/wordpress/2009/08/orientation-update/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 16:27:42 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[MozOrientation]]></category>
		<category><![CDATA[orientation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=469</guid>
		<description><![CDATA[A few days ago, I blogged about orientation support in Firefox.  I am happy to report that linux patches landed over the weekend.  (We also have Window Mobile and Thinkpads running Windows patches in the review process.) If you a linux laptop and have a few minutes, please download one of the Firefox Trunk nightly [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, I blogged about <a href="http://dougt.org/wordpress/2009/08/orientation/">orientation support in Firefox</a>.  I am happy to report that <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=512345">linux patches landed</a> over the weekend.  (We also have <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=513183">Window Mobile</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=513233">Thinkpads running Windows</a> patches in the review process.)</p>
<p>If you a linux laptop and have a few minutes, please download one of the <a href="http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mobile-trunk/">Firefox Trunk nightly builds</a> and try out orientation!</p>
<p><strong>What to try?</strong></p>
<p><a href="http://people.mozilla.org/~dougt/ori.html">http://people.mozilla.org/~dougt/ori.html</a></p>
<p>Let it run for a little bit, then shake your laptop (<em>not responsible for any damage <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </em>).  After you have a couple dozen responses, send me the results including what distro and laptop you are using.</p>
<p><strong>Demos!</strong></p>
<p>While you are testing things out, check out the demo Michael Ventnor (m.ventnor at gmail.com) put together:</p>
<p><a href="http://dougt.org/random/orientationdemo/index.xhtml"><img class="alignnone" title="Orientation Demo" src="http://dougt.org/random/orientationdemo/demo-preview.png" alt="" width="507" height="453" /></a><br />
<a href="http://dougt.org/random/orientationdemo/index.xhtml">http://dougt.org/random/orientationdemo/index.xhtml</a></p>
<p><a href="http://twitter.com/dolske">Justin Dolske</a> has a few demos too:</p>
<ul>
<li><a href="https://people.mozilla.com/~dolske/tmp/seismo.html">Seismometer</a></li>
<li><a href="https://people.mozilla.com/~dolske/tmp/awesome.html">No idea, but it&#8217;s awesome</a></li>
</ul>
<p><span><a href="http://twitter.com/jruderman">Jesse Ruderman</a> also cleaned up the &#8220;ball&#8221; demo that I created making the animation <a href="http://www.squarefree.com/smoother-orientation-demo.html">smoother</a>.<br />
</span></p>
<p><strong>Help Wanted</strong></p>
<p>There are still other platforms that I would like to support.  I specifically would like to see Windows support using their Sensor API.  If you are interested in helping, file a bug, cc me, and take a look at the other implementations.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/08/orientation-update/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Orientation in Firefox and beyond</title>
		<link>http://dougt.org/wordpress/2009/08/orientation/</link>
		<comments>http://dougt.org/wordpress/2009/08/orientation/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 03:24:02 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[accelerometer]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[htc]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[MozOrientation]]></category>
		<category><![CDATA[orientation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=452</guid>
		<description><![CDATA[One of the coolest apps I saw when the iPhone came out was the wooden balance game Labyrinth.  You basically tilt your phone to move a ball around the screen, avoiding holes, and trying to get the ball to a goal.  It made use of a feature of many modern devices &#8212; accelerometers. Obviously clear [...]]]></description>
			<content:encoded><![CDATA[<p>One of the coolest apps I saw when the iPhone came out was the wooden balance game <a href="http://en.wikipedia.org/wiki/Labyrinth_%28game%29">Labyrinth</a>.  You basically tilt your phone to move a ball around the screen, avoiding holes, and trying to get the ball to a goal.  It made use of a feature of many modern devices &#8212; accelerometers.</p>
<p>Obviously clear that there should be a webapp for doing just that.  What was missing was a javascript API.</p>
<p>In recent Mozilla trunk builds, I have added support for an orientation event.  This new event will allow you to build applications and listen for changes in orientation.  (note, the first platform to support such an event is any MacBook Pro.  Others will follow).</p>
<p><strong>Simple Call:</strong></p>
<p>To use this new event, you will add an event listener as you normally would:</p>
<p>window.addEventListener(&#8220;MozOrientation&#8221;, orientationChange, true);</p>
<p>Your callback will be called, when there is a change in acceleration, passing the current orientation:</p>
<p>function orientationChange(o) {</p>
<p>}</p>
<p><strong>Simple Result:</strong></p>
<p>The passed object has 3 attributes &#8211; &#8220;x&#8221;, &#8220;y&#8221; and &#8220;z&#8221;.  Each value is between -1 and 1 where zero is the &#8220;balance point&#8221;.  For example, suppose you device is a MacBook Pro and it is sitting on a desk that is perfectly level, you would expect to see:</p>
<p>x = 0<br />
y = 0<br />
z = 1</p>
<p>x is the axis in the direction from the left side of the keyboard to the right side of the keyboard (basically the axis that is along the home row keys) is level.  If I lift up the left side of the keyboard, x will increase.  if I lift up the right side, x will decrease.</p>
<p>y is the axis in the direction from the front of the laptop (where the mouse is) to the back of the laptop.  If I lift up the front of the laptop (the side closest to me), y will decrease.  If I left the back towards the front, y will increase.</p>
<p>Got that?  Yeah, physics is pretty hard. <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>x and y can easily be visualized.  If you have a recent trunk build for the Mac, try loading this demo page:</p>
<p><a href="http://people.mozilla.org/~dougt/ball.html">http://people.mozilla.org/~dougt/ball.html</a></p>
<p>z basically will tell you that the laptop is sitting right side up.  if z was -1, you would know that the laptop (probably closed) and is sitting on its screen.  Of course the value will change as you rotate the laptop / device in this direction.</p>
<p>Right now, there is only support for the Macbook Pro.  It is pretty easy to add support for different OSs.  We have code for Samsung Windows Mobile devices, and for the HTC Windows Mobile devices.  We still need support for linux and for Windows.  If you are interested in adding support file a bug and start looking at <a href="http://mxr.mozilla.org/mozilla-central/source/widget/public/nsIAccelerometer.idl">http://mxr.mozilla.org/mozilla-central/source/widget/public/nsIAccelerometer.idl</a></p>
<p>The API isn&#8217;t fixed and may change.  I do invite you to comment.  Keep in mind that we want a really simple and straight forward API to expose orientation events to web developers.  If your response has either &#8220;RDF&#8221; or &#8220;DCCI&#8221; in it, please reread the last sentence.  <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Thanks again and hope you enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/08/orientation/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>Geolocation Address</title>
		<link>http://dougt.org/wordpress/2009/07/geolocation-address/</link>
		<comments>http://dougt.org/wordpress/2009/07/geolocation-address/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 17:25:45 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[geo]]></category>
		<category><![CDATA[geolocation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=440</guid>
		<description><![CDATA[Last week, I pushed a change that will enable tomorrow&#8217;s trunk Firefox builds (Minefield) to access user-readable position information. For example, instead only being able to work with: 37.3882005, -122.0834553 You can see the physical address as: 650 Castro St, Mountain View, California, 94041, US This should help aide the many people that already know [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I pushed a change that will enable tomorrow&#8217;s trunk Firefox builds (Minefield) to access user-readable position information.</p>
<p>For example, instead only being able to work with:</p>
<p>37.3882005, -122.0834553</p>
<p>You can see the physical address as:</p>
<p>650 Castro St, Mountain View, California, 94041, US</p>
<p>This should help aide the many people that already know their physical address in familiar terms.</p>
<p>To access address elements, you simply do what you have been doing.  The only modification is to test to see if there is an address associated with the position, and if so, access it:</p>
<pre>
navigator.geolocation.watchPosition(successCallback)
function successCallback(position)
{
    if (position.address)
        alert(position.address.postalCode);
}
</pre>
<p>Other fields on the address object are:</p>
<pre>
address.streetNumber
address.street
address.premises
address.city
address.region
address.county
address.countryCode
address.postalCode
</pre>
<p>Please let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/07/geolocation-address/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Device Orientation</title>
		<link>http://dougt.org/wordpress/2009/03/device-orientation/</link>
		<comments>http://dougt.org/wordpress/2009/03/device-orientation/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 02:47:51 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[htc]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[orientation]]></category>
		<category><![CDATA[wince]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://dougt.wordpress.com/?p=360</guid>
		<description><![CDATA[I have a proposal for exposing device orientation in the browser. It is a pretty simple api that allows you to monitor motion changes from Javascript. For example: navigator.orientation.watchOrientation(draw); function draw(o) { // o.x, o.y, o.z } o in function draw is a vector in three dimensional space in meters / (seconds^2) units. This allows [...]]]></description>
			<content:encoded><![CDATA[<p>I have a proposal for exposing device orientation in the browser.  It is a pretty simple api that allows you to monitor motion changes from Javascript.</p>
<p>For example:</p>
<p><code><br />
navigator.orientation.watchOrientation(draw);</code></p>
<p>function draw(o) {<br />
// o.x, o.y, o.z<br />
}</p>
<p><em>o</em> in function <em>draw</em> is a vector in three dimensional space in meters /<br />
(seconds^2) units.</p>
<p>This allows you to do some revolutionary stuff on the web.  This is a simple test web page that <a href="http://people.mozilla.org/~dougt/ball.html">moves a ball around a web page</a>.  I am just loading this web page directly with <a href="https://developer.mozilla.org/en/XULRunner_1.9_Release_Notes">XUL Runner</a> on Windows Mobile Professional 6.</p>
<p><a href="http://www.youtube.com/watch?v=WYGEZreI_LU">Device Orientation on YouTube</a></p>
<p>This only supports exists on HTC devices but i do expect other devices that have accelerometers to have implementations.</p>
<p>I am tracking this feature in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=485943">bug 485943</a>.  Please check it out and let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/03/device-orientation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
