This week I’ve been working on a simple Android application. A customer of mine had the requirement for an ‘app’, but wanted to keep as much logic as possible on the mobile-web version of his web application, which is written in JQuery Mobile.

I downloaded Eclipse and installed the Android plug-in, and was amazed at how quickly I was up and running. Eclipse is a little weird on Windows, in that it doesn’t get installed, and the concept of ‘work benches’ is a bit different than I’m used to as a Windows developer– but it wasn’t too difficult to get going…

I created a simple application with a web view, and was able to access the mobile website through it fairly easily. I over-rode the back button and passed it to the web view, and I was off and rolling. The next part was a little more complex, however… I needed to implement all of this logic(potentially more in the future), in a library that I could easily inherit in ‘instances’ of this app, per se– so each one could be branded individually… This was a bit more difficult, but I was able to figure it out eventually… The biggest roadblock, was that Android seems to build all the resources together from libraries and the current app– so I had a main.xml layout in both apps, and it was discarding it from my library in favor of the one in my instanced app… This gave me errors about not being able to find the resource ID of the web view in the library code… Once I figured that out, I was on my way… I was also able to use this to my advantage, in that I could easily put any customizable parameters in my instanced app in the strings.xml file– and the library could access these resources!

So, this week I’ve started some simple Android app development. I started by downloading and installing the SDK, of course… Of course, the emulators don’t seem to work. Upon just a little digging, I found this:

That’s right– Google’s Android SDK doesn’t work on the most dominant desktop OS with the default install parameters… Seriously? How can Google act so amateurishly? Installer-writing 101 is to check on your #1 targeted platform, which would be **Desktop Windows versions**… How sad… To solve my problem, I’m un-installing and re-installing at a non-’Program Files’-ish path… Hackin’ it up to make it work for Google…

Recently, I had to debug problems with a JQuery Mobile application that I maintain– primarily, it wasn’t working with Blackberry devices. I downloaded a ‘simulator’ from RIM and got to work… The simulator is incredibly clunky, but I eventually figured it out and confirmed that the mobile web app did not work on Blackberry.

It seemed as thought he Blackberry was being excessively strict with parsing the html– enforcing xml entity quotes, etc. etc… Eventually, after trying some fixes that got me partially there, I opened WireShark and tested what headers were going across the wire that were different on JQM’s demo(which worked fine), and my mobile web app… Low and behold, I found it. JQM’s demo was properly serving a content-type of ‘text/html’, and my app was serving ‘application/xhtml+xml’.. WTF?

I was finally able to determine that a mobile.browser file I had in my ASP.NET application was causing the problem. It was CHANGING the response type based on some archaic entry in this file– which I only use for detecting if the current browser is mobile or not for redirecting reasons… I hacked the file to server text/html as it should be, and Blackberry is working MUCH better now… I still have to do a full regression of testing to make sure everything works, but this definitely appears to be the major issue that was causing problems…

Wow. I know that Apple severely cripples their phones, under clocking their processors, etc. I know that the iPhone 3G I have for testing is incredibly slow when side-by-side with my Android Samsung Galaxy S phone… But my experience with this iPhone has hit a new low… I was just debugging a problem with the iPhone showing a blank page on a functional JQuery Mobile page. It works perfectly in all desktop browsers, as well as on Android, WP7, etc. I enabled iPhone’s debug console and it’s reporting a javascript execution timeout error in JQuery 1.6.1 code. Apparently, the iPhone 3G runs so slowly that it is now timing itself out when trying to render a JQuery Mobile page…

Now I have to start trying to find a work-around to make this work… From what I understand, the javascript execution timeouts are reset with new execution contexts– of which setTimeout is one… So possibly I need to put some of my page initialization code in a setTimeout code so that it will actually run on an iPhone 3G… Amazing the lengths I must get to to make things work on all these devices….and don’t even get me started on Blackberry support…