background preloader

Phonegap / hybridappar

Facebook Twitter

Samla saker kring mobil webbutveckling samt hybridappar

Setting up console debugging for PhoneGap and Android. In case you haven’t figured it out yet, debugging in mobile is “sub-optimal”.

Setting up console debugging for PhoneGap and Android

(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.

Building HTML5 Mobile Apps with Local Storage and Topcoat

You can learn more about mobile HTML5 in my online course. Sometimes it makes sense to save some persistent data on the end user’s device, we can do this and more with out using a server-side programming language—meet local storage! Local Storage is part of the HTML5 APIs - it is an object and we can access this object and its functionality via JavaScript. During this tutorial, we will use JavaScript to take a look at the fundamentals of the local storage object and how we can store and retrieve data, client side. Requirements Text EditorWeb BrowserHTML BasicsJavaScript Basics You can download the source code here. There are multiple methods and an important property that we have access to, so let’s get started. You would type this code into a HTML5 document, inside your script tags. Setting Items Getting Items. Building an iOS signing key for PhoneGap in Windows. Building an iOS signing key for PhoneGap in Windows. Getting Started with Creating a Cordova Application.

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.

Getting Started with Creating a Cordova Application

When you create an HTML5 application you have the option to create the application using an Apache Cordova site template. Apache Cordova provides a group of APIs that enable you to develop an application with HTML, CSS and JavaScript that is packaged as a native mobile application. The application runs on the mobile device and can access the native functions of the device such as the GPS or camera. By using the Cordova APIs a developer can build a mobile application without writing any native code. This document demonstrates how to install the software that is necessary to install and develop an application with Cordova. Updated: loading external data into an iOS PhoneGap app using jQuery 1.5. Update: Following the release of PhoneGap 1.0 and XCode 4 I have updated the Git repository to include a version built with PhoneGap 0.9x (the original version) and a separate version for PhoneGap 1.xx+.

Updated: loading external data into an iOS PhoneGap app using jQuery 1.5

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.

How to elegantly handle errors in a PhoneGap app by using device API native notifications

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: