iPhone Hack – How to Develop Native iPhone Apps with Javascript/HTML!

Here’s a cool iPhone dev app called PhoneGap that allows you to develop iPhone Apps with Javascript and HTML for webmasters who know nothing about C.

PhoneGap is a free open source development tool and framework that allows web developers to take advantage of the powerful features in the iPhone SDK from HTML and JavaScript. We’re trying to make iPhone app development easy and open. For many applications a web application is the way to but in Safari you don’t get access to the native iPhone APIs, and the that’s the problem we’re trying to solve.
It is written in Objective-C and allows developers to embed their web app (HTML, JavaScript, CSS) in Webkit within a native iPhone app. We’re big advocates of the Open Web and want JavaScript developers to be able to get access iPhone features such as a spring board icon, background processing, push, geo location, camera, local sqlLite and accelerometers without the burden of learning Objective-C and Cocoa.

Here’s an example of how you could access iPhone data using Javascript:

Geo Location
//request location – this triggers a subsequent method call to gotLocation(lat,lon)

//GAP will invoke this function once it has the location
function gotLocation(lat,lon){
$(‘lat’).innerHTML = “latitude: ” + lat;
$(‘lon’).innerHTML = “longitude: ” + lon;

//You have instant access to the accellerometer data via the accelX, accelY, and accelZ variables
function updateAccel(){
$(‘accel’).innerHTML = “accel: ” + accelX + ” ” + accelY + ” ” + accelZ;

via hackszine

Download PhoneGap

Leave a Reply

Your email address will not be published.

Related News and Resources