Setting up console debugging for PhoneGap and Android. In case you haven’t figured it out yet, debugging in mobile is “sub-optimal”.
(Whatever you do – don’t do a Google Images search on sub-optimal.) Brian Leroux has an epic presentation on the topic and I highly encourage taking a look through it. I thought I’d share how I’m debugging in PhoneGap and Android right now. To be clear – this is a sucky way of doing it. “Sub-optimal” is being too nice. You will also notice an ungodly amount of messages in the main log panel. So start up your application, and you should notice the process is now listed below the device. The first thing you want to do is create a filter.
In the form that pops up, give it any name you want, but be sure to use the ‘by Log Tag’ field and specify “Web Console”: Ok, at this point, you can now see messages when your application makes use of console.log. Building HTML5 Mobile Apps with Local Storage and Topcoat. In this tutorial, we will take a look at a fundamental use case of the local storage object by explaining how the API works and creating a simple application using jQuery and Topcoat.
This document demonstrates how to create an HTML5 project in the IDE that is packaged as a mobile application and run in a mobile device simulator.
Update: Due to some issues with the recent versions of Cordova I have updated the Git repository to also include a version built with Cordova 1.7.0. My 2010 post about loading data into a PhoneGap application is by far the most viewed page of my blog so I thought I’d revisit it and write an article about a more efficient method I have been using, following the release of jQuery 1.5. Previously I had been using the wonderful JSONp jQuery plugin because jQuery 1.4 and lower did not support out of the box error handlers for JSON requests. jQuery 1.5 does, however, and it’s made things simpler and more streamlined. Updated: loading external data into an iOS PhoneGap app using jQuery 1.5. Getting Started with Creating a Cordova Application.
How to elegantly handle errors in a PhoneGap app by using device API native notifications. Making use of the device API is what makes PhoneGap so brilliant.
What’s equally brilliant is how simple it is to integrate some of these functions within your app. One of these functions is the native notification which can be used in place of, or in addition to, any error messages that you might need to display in your app. Sample iOS app project on GitHub A basic jQuery data request that might require an error message In my previous PhoneGap article I used an example of how one might load external data into an app. This would attempt to load some data and then execute some code. Using the error callback setting to handle any errors jQuery’s ajax() request can have an additional setting, just like the success handler, to deal with any error’s that might crop up.
Just like with the success handler this ajax() request will now run some code if an error is encountered. Creating a basic error handler Using a couple of techniques it’s easy to communicate if and when an error occurs: