Coder's Revolution

In my last post I played with the Media API to add sounds effects to the Roll The Ball game and made an Adobe CF Soundboard. Today I'll be showing my work with the Geolocation API. I wish I had some more time to do something more useful, but the CF mobile contest is drawing to a close tonight and I this will be the last feature I have time to put in.

Previously I played with the Accelerometer API make a "roll the ball" labyrinth game. While I found the accelerometer API easy to implement, my experiments with the Media API proved less fruitful. For a while I was afraid I would be unable to show anything at all, but after a considerable amount of fiddling (and Googling), I was able to get it working.

The Media API contains function for capturing audio and video as well playing back audio. The first thing I did was add some fun sound effects to my "roll the ball" game. And secondly, I made an Adobe ColdFusion Sound Board. But first, I had to get it working.

In my last post, I tackled two APIs-- notifications and contacts. Even though I wasn't able to fully explore the contacts, I managed to get things working without too much troubles. I'm occasionally hitting some weird parsing issues in CFBuilder or underlying JavaScript errors I can't explain but "rearranging" my code will usually make it go away (more on this later). I'll try to go back and put in tickets for these after the fact, but I'm always reticent to shout "BUG!" in a crowded theater when I'm not 100% I'm doing it right.

Accelerometer

Well, let's get right to it. Today I played with the accelerometer API which is incredibly simple in terms of the API's surface area, but rather deep in applications.

My last entry was a little light on the client APIs and mostly spent (unsuccessfully) wrestling my HTML markup around. So, to make up for it, I've implemented 2 different client APIs. That's right, two for the price of one! The first was notifications which was pretty straightforward, followed by contacts which is kind of complicated-- well, let's just say "involved".

You may notice in the screenshots that the app is no longer full screen. I didn't care for that so I found the fullscreenpreference under the project's PhoneGap properties and set it to false. This setting does not appear to be stored anywhere in the web root though, so if you check out the code into a mobile project of your own you'll probably have to set it yourself too.

In my last entry, I discussed my decision to create a "CFClient Sampler" app that would simultaneously allow me to play with each mobile client API, all the while providing the community with some nature of blog-based documentary on my attempt. With a solid proof of concept under my belt (and on GitHub) I pushed forward with two goals in mind this time:

Pick another API to play with

Figure out some organization for the code before it got out of hand

Ok, I guess there was a third goal too: Make it not so ugly.

I'll start with the last one, which was to make the app not look like a middle schooler banging something out with Microsoft FrontPage. Quite frankly, I suck at UI stuff. I'm a "function over form" guy and I'm quite happy architecting the back end of an application far far away from the perils of CSS, responsive layouts, and viewports. For this I used my phone-a-friend and dialed up jQuery Mobile. JQM has been around for a while and it doesn't make web pages that very unique (kind of like the BootStrap cookie cutter sites) but it's stupid simple to setup and covers every major navigation, button, control, and layout concern I'll be detailing with.

This venture was met with mixed success. The PhoneGap shell app which allows one to test without needing to recompile after EVERY code change fell flat out of the gate for me. I'm still waiting to hear back from Adobe on that. I was able to compile and run the sample app, but couldn't get the file APIs to work. I've sort of given up on that for now-- there's just not enough time to keep banging my head on that wall for the time being.

So after several hours of fiddling yesterday, I got a lot of the workflow understood and working but still have some major hang ups and questions. After I finished typing this E-mail to Anit, I thought to myself, "Self, why not make this conversation public so everyone can benifit from it?" There's precious little information about CFClient out there already and some people like Adam C has already expressed interest in hearing my experiences-- not that I expect to sell him on CFClient or anything :)

This is a little rambly and I apologize for that. I'll try to blog some more organized thoughts after I get this all working. So, without further ado... Anit, please reply here if you can just so everyone can benefit from the answers-- even if it means I'm a numbskull and did it all wrong.