Blog
Create an iPhone PhoneGap application in 2 easy steps
Thu, Oct 29, 2009
by
shazron

Based on Jesse’s work on PhoneGapLib, I created a PhoneGapLib installer that will install the lib unto your computer, but most importantly, it will set a Xcode global variable to allow the PhoneGap Xcode template to work. The PhoneGapLib installer will also install a PhoneGap Xcode template.

Creating a PhoneGap iPhone project has never been easier. This way also, if PhoneGap core is updated it will not affect your code. The main parts of the code should already be checked-in (see Jesse’s post for the url). This is a work in progress. [Updated: Download a preview version]

To download the code and build the installer, go to http://github.com/phonegap/phonegap-iphone and read the README.md for build instructions. No binaries are provided at this time.

See screencast below:

Download the videos: MPEG4 / H.264 “.m4v” | Ogg Theora & Vorbis “.ogv”


› Visit the original post

PhoneGap for Symbian.WRT Update
Thu, Oct 29, 2009
by
Ryan

Nokia 5800 XpressMusic

After spending some time on the Tcktcktck mobile app (built using PhoneGap, pictured), I’m back on PhoneGap. The PhoneGap port formerly known as PhoneGap Nokia should and will be renamed to PhoneGap Symbian (WRT), since Nokia’s Web Runtime is part of newer versions of Symbian OS, which is not limited to Nokia devices (Sony Ericsson too, at least). I recently dropped the Tcktcktck mobile app, built with PhoneGap Symbian.WRT, onto a SE Satio, and she worked like a charm, minus a few UI issues stemming from resolution differences.

Now it should be noted that Nokia WRT (with Platform Services, critical) is only on S60 3rd FP2 and S60 5th Edition devices, so currently PhoneGap for Symbian does not span the entire set of Symbian devices. However I’m doing some research on the side as well on building PhoneGap using the Qt 4.6 beta release, which includes QtWebkit and Symbian OS support.

robbie lou is out for at least a week and i’m crying inside.


› Visit the original post

PhoneGap Training in New York
Thu, Oct 29, 2009
by
brian.leroux

If you’re a web or mobile developer interested in building cross-platform mobile apps, then don’t miss Nitobi’s PhoneGap Training on November 20 in New York–the day after Web 2.0 Expo. In a day, we’ll teach you how to build impressive, cross-platform mobile apps with PhoneGap.

PhoneGap is an open source development tool for building fast, easy mobile apps with JavaScript. If you’re a web developer who wants to build mobile applications in HTML and JavaScript while still taking advantage of the core features in the iPhone, Android, Nokia and Blackberry, PhoneGap is for you. You can find out more about PhoneGap at www.phonegap.com.

Get a $100 Discount till November 1! We’re offering a $100 discount on PhoneGap training till November 1. Simply enter this code (earlybird) in the ‘Enter Discount Code’ field during the registration process and you’ll get $100 off!

Register now because spots are going quickly.

New York, NY
October 20, 9 am – 5 pm
The Downtown Conference Center
157 William Street, (NW corner of William & Ann Streets)
Cost: $399 (after $100 early bird discount)

Register now: http://bit.ly/34SeS7


› Visit the original post

Running jQTouch in PhoneGap
Wed, Oct 28, 2009
by
Jesse

Last week there were some discussions about the poor performance of jQTouch in PhoneGap apps, so I dug into it.

First I had to verify that this was something we were doing in PhoneGap and not a difference between Mobile-Safari and the UIWebView control which we use in PhoneGap.

I created a PhoneGap project and dropped the jQTouch sample code into the www folder, and immediately noticed the sluggish performance.

I then created a bare bones iPhone Windowed application with a UIWebView in it, and dropped the same www folder contents into the project root.

NSURL *appURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"www"]];
NSURLRequest *appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
[webView loadRequest:appReq];

After running both builds on the device it was obvious that the PhoneGap version was in fact sluggish compared to the bare-bones version. Verified!

So, thinking about what could be causing this, I looked into the PhoneGapDelegate code, and immediately saw the Accelerometer handling code the a potential culprit. The PhoneGapDelegate class asks the sharedAccelerometer for updates 40x per second. According to the Applei Phone dev docs, this interval is “Suitable for games and other applications that use the accelerometers for real-time user input.” Which is cool, but probably way more than this application needs considering it isn’t even being used. Every time that the sharedAccelerometer calls back with an update, the javascript is written into the webView’s DOM. Commenting out the accelerometer code that sets up the interval indeed fixes the majority of the sluggishness. Verified! Pretty smooth, eh?

Okay, so commenting it out isn’t really a solution, so here is the plan:
I am working to re-implement the Accelerometer portion as a command, that can be used more elegantly. Javascript code inside the www folder should have the ability to set how frequently it wants be updated, and have the ability to start + stop monitoring the accelerometer, which should also remove the overhead.

Note:
If your application does not use the accelerometer, instead of commenting out the code like I did, you can simply set “EnableAcceleration” to false in PhoneGap.plist.

I will post an update here when I have checked in anything of significance.


› Visit the original post

PhoneGap Static lib for iPhone-XCode
Tue, Oct 27, 2009
by
Jesse

I recently spent some time evaluating the iPhone branch of PhoneGap and have made some changes that I think will make things easier to develop.

One of the key issues that I wanted to address was that PhoneGap existed as a repository and anyone that made an application with it would invariably have to mix their code in. In a very few cases it is possible to make a complete application using PhoneGap out of the box, but what if you need to add, remove or change something? As soon as you start messing with the core PhoneGap code, you are looking at huge merge issues when updates are pushed to the PhoneGap repo. Most likely you will just ignore any new commits, and your code will be stuck in time from the moment you changed it, or you will have to pick through the updates, and decide what is worth re-implementing in your own codebase.

My changes work as follows: You do not create a PhoneGap app anymore! You create an app that inherits from PhoneGap. This means your PhoneGap code can be in a git repo somewhere (github) while your application code can be in it’s own repo. If there are updates to the PhoneGap codebase then ( as long as the API has not changed ) you simply update PhoneGap and build your app.

In order to make these changes, I had to simplify some of the PhoneGap code. I removed the dependency on XIB files so the UIWebView is now created through code instead of automagically by XCode boilerplate code behind the scenes. The PhoneGap core code is now a static library that you link to and inherit from so there are some things you will have to do to create a new phonegap application. Also keep in mind that this is all subject to change as we are currently looking at ways of making this dead-simple.

You can git the code here: http://github.com/phonegap/phonegap/tree/plugins/iphone/

The new PhoneGap 12 step program

  1. In XCode create a new WindowBased iPhone Application.
  2. Select the project and add a reference to the PhoneGapLib project. ( The one you downloaded from git )
  3. Add a reference to all headers in the PhoneGapLib project ( these are needed so the compiler can know what you will be linking against, and what the base PhoneGapDelegate protocol looks like )
  4. Delete the MainWindow.XIB interface builder file that XCode created.
  5. In main.h add your app delegate class name to the UIApplicationMain call.
    ex.
    int retVal = UIApplicationMain(argc, argv, nil,@"MyAppDelegate");
  6. Change the interface of your application delegate to inherit from PhoneGapDelegate.
    ex.
    @interface MyAppDelegate : PhoneGapDelegate { }
  7. Select the build target in your project and add a dependency for PhoneGapLib.
  8. Add libPhoneGapLib.a to the ‘Link Binary with Library’ build step.
  9. Add the www folder to the ‘Copy Bundle Resources’ build step.
  10. Place phonegap.js in your www folder along with all your html/css/js application code.
    ( note: this is a little bit hack-y, and we are looking at ways of improving this step especially )
  11. Add project references to the following frameworks
    • AddressBook.framework
    • AddressBookUI.framework
    • AudioToolbox.framework
    • AVFoundation.framework
    • CFNetwork.framework
    • CoreGraphics.framework
    • CoreLocation.framework
    • Foundation.framework
    • MediaPlayer.framework
    • QuartzCode.framework
    • SystemConfiguration.framework
    • UIKit.framework
  12. Build and Go.

So What’s Next?

Recent PhoneGap discussions have led us to the conclusion that we need a plug-in architecture. It will be much easier to get people to contribute if they can focus on a key piece of functionality and not have to implement things throughout the codebase + it also gives a clearer separation of contributions and would allow for unit testing.  This latest addition/change is a step towards a more plug-able architecture. Thanks also to Shazron for his help, support and suggestions along the way.

So get reviewin’ !!


› Visit the original post

PhoneGap 0.8.0 is Apple Approved
Wed, Oct 7, 2009
by
brian.leroux

Its official: PhoneGap 0.8.0 is approved by Apple.

After an epic amount of blog campaigning, twitter rebuttals, email group frustration and obfuscation hackery we can now say that Apple approves of PhoneGap.


All along we knew that PhoneGap was within the licensing terms of the iPhone SDK and the unwarranted rejections where simply unfair to the development community. We can now get back to the business of building the best device agnostic open web mobile platform.

A huge thanks to iPhone PhoneGap contributor Mike Nauchbar for taking this crusade on!


› Visit the original post