<?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>Joe@Nitobi</title>
	<atom:link href="http://blogs.nitobi.com/joe/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.nitobi.com/joe</link>
	<description>A blog about what I do during the day</description>
	<lastBuildDate>Wed, 09 Jun 2010 18:04:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Not all cameras are equal</title>
		<link>http://blogs.nitobi.com/joe/2010/06/09/not-all-cameras-are-equal/</link>
		<comments>http://blogs.nitobi.com/joe/2010/06/09/not-all-cameras-are-equal/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 18:04:30 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=226</guid>
		<description><![CDATA[Recently, the way we were creating a camera and using it broke.  I&#8217;m not sure why it broke, but I decided to say screw it and to use the Camera Intent in Android, because that&#8217;s what you&#8217;re supposed to do on Android anyway.  This is what most Twitter Applications use, and since Twitter [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, the way we were creating a camera and using it broke.  I&#8217;m not sure why it broke, but I decided to say screw it and to use the Camera Intent in Android, because that&#8217;s what you&#8217;re supposed to do on Android anyway.  This is what most Twitter Applications use, and since Twitter Apps are probably the most used application on Android, I figure if it&#8217;s good enough for them, it&#8217;s good enough for me&#8230;</p>
<p>Oh how wrong I was!!!</p>
<p>I added the new intent code, and I tested it on four phones.  I tested it on the HTC EVO 4G that I received from Google IO, the Nexus One, the Motorola Milestone with the official Telus Firmware (with camera), the HTC Dream with stock Android 1.6 and the Rogers HTC Magic with Android 1.5 and the 9/11 update.  Basically, everything worked but the Rogers HTC Magic.  The thing is that once you use intents, you are relying on the OEMs to write a good enough Android Camera Application for you to get a picture from.  This may be good for a Google blessed image, or a stable HTC phone like the EVO, but it&#8217;s clear that on certain phones from certain providers, that there may be some issues.</p>
<p>I&#8217;m certain that there&#8217;s phones in the wild that have broken cameras, and it&#8217;d be good to find out which phones have broken cameras.  If people could test on these phones (with Canadian carriers next to them), that would be greatly appreciated:</p>
<ul>
<li>HTC Hero (Telus)</li>
<li>LG EVE (Rogers)</li>
<li>Motorola DEXT (Bell)</li>
<li>Motorola Quench (Rogers)</li>
<li>Motorola Backflip (Telus)</li>
<li>Samsung Galaxy (Bell/Rogers)</li>
<li>Acer Liquid E (Rogers)</li>
<li>Xperia X10 (Rogers)</li>
</ul>
<p>Those are the phones that I know are in the wild in Canada.  I&#8217;m sure there&#8217;s more than this in other countries, namely in the United States, but this is a good cross-section  of devices from a handful of manufacturers who may have their own customized camera applications.  I&#8217;ve exempted test devices from this post, because I don&#8217;t think it&#8217;s fair to take a broken firmware and say &#8220;Hey, the Camera Doesn&#8217;t work!&#8221;.  However, the HTC Magic should work, and it&#8217;s disappointing that it doesn&#8217;t, since this breaks not only PhoneGap&#8217;s camera capability, but anything that uses that intent.  Hopefully in the future, Android cameras will be more reliable.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/06/09/not-all-cameras-are-equal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PhoneGap across ALL ANDROID DEVICES</title>
		<link>http://blogs.nitobi.com/joe/2010/05/31/using-phonegap-across-all-android-devices/</link>
		<comments>http://blogs.nitobi.com/joe/2010/05/31/using-phonegap-across-all-android-devices/#comments</comments>
		<pubDate>Mon, 31 May 2010 19:27:20 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=216</guid>
		<description><![CDATA[This is my biggest pet-peeve to date.  We get a lot of people trying to use PhoneGap across all devices.  However, despite the work that people have done on droidgap, most people still use Eclipse as the primary way they develop with Android, because that&#8217;s what people read in the Wiki.
The problem is [...]]]></description>
			<content:encoded><![CDATA[<p>This is my biggest pet-peeve to date.  We get a lot of people trying to use PhoneGap across all devices.  However, despite the work that people have done on droidgap, most people still use Eclipse as the primary way they develop with Android, because that&#8217;s what people read in the Wiki.</p>
<p>The problem is that when you start developing for Eclipse, you notice that PhoneGap is set to the latest version of Android.  However, for some reason people want to change their target because they&#8217;re running an earlier version of Android.  Since they use Eclipse to deploy their app, they are misled to believe that if you write an APK, you must target only one version.</p>
<p>If we&#8217;re deploying multiple APKs, PhoneGap has FAILED to do the job it was meant to do.  If you have to change the target, there is something wrong!</p>
<p>Now, why do I say that, because I discovered this when using Eclipse:</p>
<ul>
<li>Automatic Selection of your running target is EVIL!</li>
<li>Manual Selection allows you to choose your APK</li>
</ul>
<p>The reason Automatic Selection is evil is because it will launch an Emulator and go for the highest level device it can go.  Not what you&#8217;re running, but whatever the highest device is.   This is the correct behaviour, but this does NOT help people who are looking to test it on their device.  This causes people to instinctively mess with PhoneGap and do bad things like change the target.  Here&#8217;s why you should NEVER have to change the target:</p>
<p><code style="xml"><br />
	<uses-sdk android:minSdkVersion="2" /><br />
</code></p>
<p>This is the line from the AndroidManifest.xml.  This sets the Minimum SDK Version to 2, which is Android 1.5.  A while ago, we fixed the Android 1.5 issues by changing the conditional compatibility code to look for the SDK string.  We could probably do this better, and we&#8217;ll look into it in the coming weeks.  However, as it stands right now, this is how we do it, and it works.</p>
<p>The other thing that annoys me about eclipse that I&#8217;m sure causes people to change it is this:<br />
<a href="http://blogs.nitobi.com/joe/wp-content/uploads/2010/05/device_chooser1.png"><img src="http://blogs.nitobi.com/joe/wp-content/uploads/2010/05/device_chooser1.png" alt="" title="device_chooser" width="573" height="390" class="aligncenter size-full wp-image-217" /></a></p>
<p>This is the stupidest UX ever.  It should be a warning, not big red X, and this causes a LOT of headache and unnecessary gnashing of teeth.  If you click OK, it will actually run on the device.  As you see here, this is pointing to my Nexus One, which is still running Android 2.1-update1.  I&#8217;m currently building PhoneGap for Froyo, BUT it still runs, and it works fine.  This is actually how you can have one APK that runs on all devices.</p>
<p>I can see how someone wouldn&#8217;t want to support all Android devices, BUT given the fact that according to Google, <a href="http://d.android.com/resources/dashboard/platform-versions.html">Android 1.5 and 1.6 phones far outnumber the Android 2.x devices,</a> it makes sense to make one APK to rule them all.  The idea is to write once and deploy anywhere, and not write once and deploy to every single version of the platform.  If this doesn&#8217;t work for you, you&#8217;ve found a bug, and we would appreciate it if it was filed.  It&#8217;s important for PhoneGap to both run on Android 1.5 AND be able to take advantage of all the latest browser features, and the current approach we are using with the EDGE version allows us to do exactly that.</p>
<p>Fragmentation?  The only fragmentation on Android that we care about is the fragmentation between WebKit versions, but that&#8217;s another issue entirely.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/05/31/using-phonegap-across-all-android-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Canvas + Accelerometer on Android</title>
		<link>http://blogs.nitobi.com/joe/2010/04/27/canvas-accelerometer-on-android/</link>
		<comments>http://blogs.nitobi.com/joe/2010/04/27/canvas-accelerometer-on-android/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 20:34:17 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=204</guid>
		<description><![CDATA[Over the past month, I was working from home, and when I wasn&#8217;t busy wiping spit-up from my kid&#8217;s face, I was working on various stuff, including a new Android PhoneGap demo to replace the one that I took off the Android market.  The problem with these demos is that they do not stand [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past month, I was working from home, and when I wasn&#8217;t busy wiping spit-up from my kid&#8217;s face, I was working on various stuff, including a new Android PhoneGap demo to replace the one that I took off the Android market.  The problem with these demos is that they do not stand the test of time.  However, this one should.  After playing with C5Bench a couple months ago, I decided to do a quick hack of the Canvas.  After many bug fixes to PhoneGap Android later, I finally managed to put together this simple example:</p>
<p><a href="http://blogs.nitobi.com/joe/wp-content/uploads/2010/04/phone_gap_screen.png"><img src="http://blogs.nitobi.com/joe/wp-content/uploads/2010/04/phone_gap_screen.png" alt="" title="phone_gap_screen" width="320" class="alignleft size-full wp-image-205" /></a></p>
<p>Now, of course, this is an early version, and the code has been thrown together very quickly, and there are bugs, which is why I haven&#8217;t posted it in the market, but you can download and try out the application <a href="http://blogs.nitobi.com/joe/AccelDemo.apk">here</a>, or scan in the QR code below.</p>
<p><a href="http://blogs.nitobi.com/joe/wp-content/uploads/2010/04/accel_demo_qr.png"><img src="http://blogs.nitobi.com/joe/wp-content/uploads/2010/04/accel_demo_qr.png" alt="" title="accel_demo_qr" width="120" height="120" class="alignnone size-full wp-image-208" /></a></p>
<p>This code is based on a few examples that I found on the web of good Canvas Tutorials, namely the <a href="http://billmill.org/static/canvastutorial/">Breakout Clone tutorial</a> by Bill Mill.  It&#8217;s a pretty solid tutorial and shows how to effects like bounce fairly effectively.  Of course, I didn&#8217;t add bounce, because I wanted more of a sliding bubble effect.  I also decided to NOT use the jQuery framework to keep the javascript code as small as possible.  (In fact, I didn&#8217;t even use XUI, since I didn&#8217;t see the need).</p>
<p>That being said, I&#8217;m definitely going to have to work on my own JS library at some point that maintains complex objects, since redrawing functions can quickly become large and cumbersome, even when using a JS library, which is better suited to the DOM and not pixel-manipulation.</p>
<p>So, basically you move around two objects which are directly related to each other on a screen with the accelerometer, and the method that we use is below:</p>
<p><code><br />
var watchAccel = function()<br />
{<br />
  var canvas = document.getElementById("canvas");<br />
  canvas.width = document.body.clientWidth;<br />
  canvas.height = document.body.clientHeight - 100;<br />
  ctx = canvas.getContext("2d");<br />
  var succ = function(a){<br />
    updateValues(a);<br />
    updateDraw(a);<br />
  };<br />
  var fail = function(){};<br />
  var opt = {};<br />
  opt.frequency = 100;<br />
  timer = navigator.accelerometer.watchAcceleration(succ, fail, opt);<br />
}<br />
</code></p>
<p>Now, what&#8217;s interesting is how the frequency is handled.  Currently, we use the setInterval to do this, exactly like the iPhone.  However, this actually kinda sucks, and we may in the future move more of this into the Java land, similar to how we manage the Geolocation code that we use.  However, this is good enough to create the sliding bubble effect of the application.  I hope to have the final version of the app up and working before Google IO, however I&#8217;ll probably post it up to GitHub this week, feel free to try and and let me know if there&#8217;s serious issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/04/27/canvas-accelerometer-on-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android without Eclipse</title>
		<link>http://blogs.nitobi.com/joe/2010/03/26/android-without-eclips/</link>
		<comments>http://blogs.nitobi.com/joe/2010/03/26/android-without-eclips/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 23:32:23 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=202</guid>
		<description><![CDATA[Now, for people who are Java developers, I can understand the attachment to Eclipse, but for the rest of us, Eclipse is a giant piece of bloatwear that gets in the way of the code and what we want to do with that code.  However, it&#8217;s a fact of life for Android developers, or [...]]]></description>
			<content:encoded><![CDATA[<p>Now, for people who are Java developers, I can understand the attachment to Eclipse, but for the rest of us, Eclipse is a giant piece of bloatwear that gets in the way of the code and what we want to do with that code.  However, it&#8217;s a fact of life for Android developers, or is it?</p>
<p>Building and running Android Applications:</p>
<p>Now, the first command that we deal with is the android command, which can generate a project.  In typical java fashion, it takes a crap ton of flags, but you can create a project by typing this:</p>
<p><code><br />
android create project -t 7 -k package name - a name -n name<br />
</code></p>
<p>This will create an android project.  Now, on Android, the DroidGap script actually uses the Android script to create a project.  So, once you have your project, what do you do with it?  Well, the first thing to do is to build it, which you can do with ant.  When you type ant on an Android project, you&#8217;ll get a list of commands like this:</p>
<pre>
help:
     [echo] Android Ant Build. Available targets:
     [echo]    help:      Displays this help.
     [echo]    clean:     Removes output files created by other targets.
     [echo]    compile:   Compiles project's .java files into .class files.
     [echo]    debug:     Builds the application and signs it with a debug key.
     [echo]    release:   Builds the application. The generated apk file must be
     [echo]               signed before it is published.
     [echo]    install:   Installs/reinstalls the debug package onto a running
     [echo]               emulator or device.
     [echo]               If the application was previously installed, the
     [echo]               signatures must match.
     [echo]    uninstall: Uninstalls the application from a running emulator or
     [echo]               device.
</pre>
<p>I think this is pretty self-explanatory, BUT there needs to be something said for the difference between debug versions and release versions of the same piece of software.  Most of the time, you&#8217;ll want to sign the apks with a debug key, so that these are specific to your workstation.  However, when releasing a project, you will want to sign it with a key in the keystore.  <em>(It&#8217;s important to take care of your keystore and not to do what I did and forget about it.  This is why I haven&#8217;t gotten a free Nexus One from Google for the PhoneGap Demo Application.)</em></p>
<p>Of course, this only works either for one phone, or one emulator.  What if you have multiple emulators?  No problem, use adb.  The Android Debug Bridge is one of the most handy tools in the Android Developers toolkit, and is extremely handy for debugging.  To see what devices you have, run adb devices like this:</p>
<p><code><br />
bowserj@shapley:~/Orbot$ adb devices<br />
List of devices attached<br />
0123456789012	device<br />
</code></p>
<p>To install an APK onto a device, type the following:<br />
<code><br />
apk -s 0123456789012 install phonegap.apk<br />
</code></p>
<p>Debugging Javascript and Java on the Android WITHOUT ECLIPSE</p>
<p>Now, here&#8217;s where things get interesting.  When you need to debug javascript in the latest version of PhoneGap, you can use logcat to do so, all you need to do is run adb logcat, like this:</p>
<p><code><br />
adb logcat<br />
</code></p>
<p>Of course, to actually use a Java Debugger, such as jdb, you need to attach it to a process on the device.  ADB has you covered as well, all you need to do is this:<br />
<code><br />
adb jdwp<br />
</code></p>
<p>Then once you have the PID that you want, do this:<br />
<code><br />
adb forward tcp:8000 jdwp:
<pid-value>
jdb -attach localhost:8000<br />
</code></p>
<p>Then you&#8217;re in!  Make sure that you don&#8217;t have another process (i.e. Eclipse) running that connects to this, and you should be able to debug your Java code just like how you would debug Java code normally.  I admit that I&#8217;m not a jdb/gdb ninja and things like DDD have made me dumb.  Therefore, I&#8217;d appreciate any book recommendations on how to use JDB/GDB for debugging.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/03/26/android-without-eclips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ada Lovelace Day Post</title>
		<link>http://blogs.nitobi.com/joe/2010/03/24/ada-lovelace-day-post/</link>
		<comments>http://blogs.nitobi.com/joe/2010/03/24/ada-lovelace-day-post/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 00:18:50 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=199</guid>
		<description><![CDATA[Last year at this time, I did a post about Ada Lovelace Day, and once again I&#8217;m back at it, doing another post, this one is going to be pretty short.  This year, I wasn&#8217;t sure why I was going to write a blog post about, so I figure that this time, I&#8217;ll just [...]]]></description>
			<content:encoded><![CDATA[<p>Last year at this time, I did a post about Ada Lovelace Day, and once again I&#8217;m back at it, doing another post, this one is going to be pretty short.  This year, I wasn&#8217;t sure why I was going to write a blog post about, so I figure that this time, I&#8217;ll just write about my 2nd Year Computer Architecture Professor, Desa.</p>
<p>Desanka Polajnar was probably the first CS professor that actually made people worry about failing a Computer Science course when I was up at UNBC  ten years ago.  People for some reason couldn&#8217;t quite understand how boolean logic worked, and why K-Maps were a good idea.  In fact, many people didn&#8217;t even realize why it was relevant to learn Assembly Programming at all, and many people consider knowing the internals of a processor a waste of time.  I remember hating the first CPSC 230 class, because it was hard, and because it seemed to have absolutely no bearing, or connection to what I&#8217;d be doing now.  I also remember thinking that MIPS and ARM assembly was useless because you know, everything runs on an x86.</p>
<p>Also, it was in her class that I got introduced to Hardware, which has turned into a pretty awesome hobby.  It&#8217;s strange, since to this day, I haven&#8217;t met too many people that even know what a PDP-8 even is, let alone actually implement it with microcontrollers and TTL logic.  Thanks  to Desa, I can say that I actually have done that, and I think that&#8217;s pretty awesome.  I definitely appreciate the time I spent in her classes, even if I didn&#8217;t seem like it back in the 90s, when I was actually in them.</p>
<p>Thanks</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/03/24/ada-lovelace-day-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Tale of Two Androids</title>
		<link>http://blogs.nitobi.com/joe/2010/03/18/a-tale-of-two-androids/</link>
		<comments>http://blogs.nitobi.com/joe/2010/03/18/a-tale-of-two-androids/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 23:28:05 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=196</guid>
		<description><![CDATA[After being shown many more ways of writing applications on Android, I decided to investigate the possibility of using the V8 Javascript Engine in Android Scripting Environment.  I saw what was done with the other platforms, so it should just be a simple matter of porting node.  Unfortunately, I&#8217;m not there yet, so [...]]]></description>
			<content:encoded><![CDATA[<p>After being shown many more ways of writing applications on Android, I decided to investigate the possibility of using the V8 Javascript Engine in Android Scripting Environment.  I saw what was done with the other platforms, so it should just be a simple matter of porting node.  Unfortunately, I&#8217;m not there yet, so I started with what I know should exist, which is V8.</p>
<p>Blogs have it on good authority that Android Webkit now uses V8 as its Javascript Engine instead of JSC as it used to in previous versions of Android.  Now, in the <a href="http://source.android.com">Android Open Source Project</a>, the build system that is used there (which has<a href="http://pdk.android.com"> even less documentation </a>than the WebKit docs on the Android SDK), has the ability to compile every single module in Android independently.  However, if you type the following:</p>
<p><code><br />
make modules<br />
</code></p>
<p>You will notice that libv8 and v8shell are lacking.  However, if you run this:</p>
<p><code><br />
make modules JS_ENGINE="v8"<br />
</code></p>
<p>You will then notice that you will have access to these things.  Given that most phone companies do their own builds of the OS, it&#8217;s not clear which phone has v8 and which phone does NOT have V8.  I&#8217;m certain HTC knows this, but what about Motorola, Sony, LG, Dell, Acer or any of the other manufacturers of phone who all do their own builds and all have their own buildbots.  It&#8217;d be great if you could find out which engine you were running on your phone, since WebKit can run many JavaScript engines, and soon we&#8217;ll be able to run Javascript on the phone wherever we want.  Of course this is more pie in the sky than the reality, which looks like this:</p>
<pre>
adb shell
$ cd /tmp/
$ ./v8shell
V8 version 1.3.10 (candidate)
> print('Hello world');
Hello world
>
</pre>
<p>We&#8217;re working on it, and we&#8217;ll see what happens when this does exist.  In the meantime, the DroidScript stuff is really interesting, and the more ways to develop on Android, the better.  While some people are married to the idea of Java, I like the idea of writing whatever works for the developer.  If anyone can recommend some solid books on Makefiles, that would be greatly appreciated.  If I ever manage to get this to work, I&#8217;ll have an APK for download.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/03/18/a-tale-of-two-androids/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Curiosity of the Day: DroidScript</title>
		<link>http://blogs.nitobi.com/joe/2010/03/12/curiosity-of-the-day-droidscript/</link>
		<comments>http://blogs.nitobi.com/joe/2010/03/12/curiosity-of-the-day-droidscript/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 23:47:10 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=191</guid>
		<description><![CDATA[Recently, a blog post came forward from Mikael Kindbord about running Rhino on Android.  I was then asked to take a look at it,and it was pretty interesting.  He recently released a project called DroidScript, which is actually really interesting.  It&#8217;s an interesting front-end to Rhino, and it has the Javascript using [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, a blog post came forward from <a href="http://divineprogrammer.blogspot.com/">Mikael Kindbord</a> about running Rhino on Android.  I was then asked to take a look at it,and it was pretty interesting.  He recently released a project called <a href="http://github.com/divineprog/droidscript">DroidScript</a>, which is actually really interesting.  It&#8217;s an interesting front-end to Rhino, and it has the Javascript using Dalvik Android classes with Javascript so that you can have intents and invoke any method in Javascript that you can in Java.  It does produce some pretty verbose code, and while I&#8217;m not going to re-structure Android PhoneGap so that it uses this just yet, it&#8217;s an interesting thought experiment in how many different ways you can write code for Android.</p>
<p>If you&#8217;re interested in Android and Javascript, I high recommend checking it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/03/12/curiosity-of-the-day-droidscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LOLWUT?  Canvas Benchmarking on C5Bench and Xperia X10</title>
		<link>http://blogs.nitobi.com/joe/2010/02/26/lolwut-canvas-benchmarking-on-c5bench-and-xperia-x10/</link>
		<comments>http://blogs.nitobi.com/joe/2010/02/26/lolwut-canvas-benchmarking-on-c5bench-and-xperia-x10/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 20:33:37 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=189</guid>
		<description><![CDATA[Recently, I started looking at Canvas on Android, and I came across the C5 Canvas Benchmarking test.  I tested it on both the Motorola Milestone that I recently bought, and the Sony Ericsson Xperia X10, and it was pretty surprising.  Now, it should be noted that the Motorola Milestone has a TI OMAP3430 [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I started looking at Canvas on Android, and I came across the C5 Canvas Benchmarking test.  I tested it on both the Motorola Milestone that I recently bought, and the Sony Ericsson Xperia X10, and it was pretty surprising.  Now, it should be noted that the Motorola Milestone has a TI OMAP3430 processor, and is capable of speeds up to 600 MHz.  However, the Xperia X10 has a Qualcomm Snapdragon processor, and has a clockspeed of 1.02 GHz.  Now, people have been speculating whether this clock speed will make a difference, and I think that<a href="http://www.c5bench.com/results/?fps=1"> when you look at the results</a>, it clearly does.</p>
<p>Now, I don&#8217;t think that performance is quite there yet, but you may see more advanced uses of Canvas on mobile web applications in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/02/26/lolwut-canvas-benchmarking-on-c5bench-and-xperia-x10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>console.log on Android WebView</title>
		<link>http://blogs.nitobi.com/joe/2010/02/26/console-log-on-android-webview/</link>
		<comments>http://blogs.nitobi.com/joe/2010/02/26/console-log-on-android-webview/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 19:18:57 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=186</guid>
		<description><![CDATA[I recently bought a new phone, the Motorola Milestone from Telus.  The Milestone currently features Android 2.0.1, and is the first Canadian phone that actually features Android 2.  So, while confirming fixes on the device, I noticed in LogCat that my WebCore wasn&#8217;t logging error messages.  For those of you who don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I recently bought a new phone, the Motorola Milestone from Telus.  The Milestone currently features Android 2.0.1, and is the first Canadian phone that actually features Android 2.  So, while confirming fixes on the device, I noticed in LogCat that my WebCore wasn&#8217;t logging error messages.  For those of you who don&#8217;t know, on Android 1.x, you could debug your javascript by using adb logcat and grepping for the WebCore errors.  This frustrated me, since this wasn&#8217;t listed in the API changes.  I then decided to sift through the WebView source code, and I found addMessageToConsole.</p>
<p>The method addMessageToConsole is a method that currently exists on the WebChromeClient that can be overriden with your own custom error message.  Now, according to the Google Documentation, this is not a public method to be used until Android 2.1.  However, I just tested it on my Motorola Milestone, and the method actually works.  I&#8217;ve included this fix to PhoneGap and you should now be able to go back to debugging your Javascript directly on the device, as opposed to the other methods of using a different browser.</p>
<p>BTW: The code to add it is as follows:</p>
<p><code class="java"><br />
	public final class EclairClient extends WebChromeClient<br />
	{<br />
		private String TAG = "WebErrorLog";<br />
                // This is a test of console.log, because we don't have this in Android 2.01<br />
		public void addMessageToConsole(String message, int lineNumber, String sourceID)<br />
		{<br />
			Log.d(TAG, sourceID + ": Line " + Integer.toString(lineNumber) + " : " + message);<br />
		}<br />
	}<br />
</code></p>
<p>For backwards compatibility with Android 1.6, it&#8217;s a good idea to have this class extend a pre-existing WebChromeClient, and to dynamically chose the client you instantiate so you can actually get your application working.  </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/02/26/console-log-on-android-webview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhoneGap Android: Creating projects and filing bugs</title>
		<link>http://blogs.nitobi.com/joe/2010/01/06/phonegap-android-creating-projects-and-filing-bugs/</link>
		<comments>http://blogs.nitobi.com/joe/2010/01/06/phonegap-android-creating-projects-and-filing-bugs/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 18:35:10 +0000</pubDate>
		<dc:creator>Joe B</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://blogs.nitobi.com/joe/?p=177</guid>
		<description><![CDATA[So, apparently I forgot to mention the build.rb script I wrote last year.  It&#8217;s checked into the phonegap-android repository, and you can pull it.  To use it, you just have to do the following:
1. First, build a PhoneGap.jar (this should be built before being distributed in future releases)

ant jar


2. Run build.rb with the [...]]]></description>
			<content:encoded><![CDATA[<p>So, apparently I forgot to mention the build.rb script I wrote last year.  It&#8217;s checked into the phonegap-android repository, and you can pull it.  To use it, you just have to do the following:</p>
<p><strong>1. First, build a PhoneGap.jar (this should be built before being distributed in future releases)</strong><br />
<code><br />
ant jar<br />
</code></p>
<p><strong><br />
2. Run build.rb with the various attributes:</strong><br />
<code><br />
ruby build.rb TestApp com.testapp www /foo/bar<br />
</code></p>
<p><strong>3. Profit.<br />
</strong></p>
<p>You should have a test application created.  The application name should have no spaces, and it&#8217;s expected that you know enough about Android development to change the res/values/strings.xml file to what you want it to be (you don&#8217;t need to know much).  The www directory should have an icon.png in it for the icon that you want to use with your application.  It&#8217;s an early script, and it&#8217;s an intermediary step that&#8217;s designed to make life easier for those who don&#8217;t want to bother with Eclipse.  </p>
<p>Also, many people go here to post bugs.  While I appreciate all the comments I get on Android, it works better if the bugs are also filed in the <a href="http://phonegap.lighthouseapp.com">PhoneGap bug tracker</a>.  That way I can keep track of what&#8217;s broken.  It&#8217;s also the place to put feature requests, since like the Android developers themselves, I will often not reply to the forums because I&#8217;ll be too busy with other tasks.  I hope to have a plugins project added here soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.nitobi.com/joe/2010/01/06/phonegap-android-creating-projects-and-filing-bugs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
