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)
getLocation();

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

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

via hackszine

Download PhoneGap




Tags: , , , , , , , , , , , , , , , , , , ,


Rate

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...
blog comments powered by Disqus

Related Posts

Bookmark It!


Email this to a Friend Email This Post Email This Post

If you like this post then please subscribe to my full feed RSS. You can also subscribe by Email.

Got a new hack, DIY, howto, or gadget? Tip us here.

Try Goohack to find a new Hack:


Featured Sites From Zedomax Blog Network