background preloader

PhoneGap Data Transfer

Facebook Twitter

Adding Database Synchronization to Your PhoneGap Project. For the past few days I've been working on a proof of concept PhoneGap application that demonstrates an example of database synchronization.

Adding Database Synchronization to Your PhoneGap Project

This is a fairly complex topic and I'm only going to demonstrate one version of this, but I hope the concepts, code, and example application are useful to people hoping to tackle the same problem. Before we start digging into code, let me explain what the application will demonstrate and the type of synchronization it will use. Our sample application is going to use a built-in database for documentation. Most mobile applications don't really have a lot of documentation. Anything that complex may not make sense on mobile anyway. This documentation may or may not ship with the application, but we want the application to sync with a remote server in order to get the latest and greatest documentation. If the remote server adds new docs, the app needs to get it. We have two pieces to this proof of concept, the server and the client. 01. <! Simple Offline Data Synchronization for Mobile Web and PhoneGap Applications. Being able to work offline is an expected feature of mobile applications.

Simple Offline Data Synchronization for Mobile Web and PhoneGap Applications

For data-driven applications, it means that you — the developer — will have to store (a subset of) your application data locally, and implement a data synchronization mechanism that keeps your local and server data in sync. In this article, I describe a simple data synchronization strategy that uses the device’s (or browser’s) SQLite database. The implementation currently leverages the Web SQL API (even though the W3C is no longer actively maintaining the spec) because both iOS and Android support it, but they don’t support IndexedDB, the official alternative. However, the API described below — getLastSync(), getChanges(), applyChanges() — defines a generic synchronization contract, and the solution can be expanded and made “pluggable”: You could create different synchronization objects, each providing a different implementation of these methods. Try it in the Playground Server API 10:20:56 Client API getLastSync()

Php - Retrieve database data with Phonegap. PhoneGap Ajax Sample. PhoneGap AJAX Quick Start Example for Android, BlackBerry WebWorks, Samsung Bada, or Nokia Symbian Mobile App Development using XMLHttpRequest. Here is a ready-to-run alternative PhoneGap with AJAX example using simple JavaScript.

PhoneGap AJAX Quick Start Example for Android, BlackBerry WebWorks, Samsung Bada, or Nokia Symbian Mobile App Development using XMLHttpRequest

It is for starting project development and assumes you have PhoneGap and all tools already installed and running... Basically if you are at the quick start stage of your app development and still trying PhoneGap but need AJAX, this example might interest. Or if you are having any problems with other AJAX releases you might give this a try. Note there are only three source code samples required: this PhoneGap index.html, the JavaScript AJAX source, and the sample XML data file. Best of luck, hope it helps. * also note phonegap-1.0.0.js is the latest PhoneGap tested here... ( + all javascript files moved to the javascript subdirectory or folder referenced.. also any 'phonegap.js' files renamed to include a version number for consistency).

JavaScript simpleMobileAjax.js: PhoneGap Mobile OS Platforms phonegap.xml: <? Var onLoad = function() { if (navigator.userAgent.indexOf("webOS") !