Results 1 to 3 of 3
  1.    #1  
    Developing Cross Platform Apps with PhoneGap: Part 2, Android

    Well, this is long way down post to copy here on this forum so I suggest to go the Palm link to read it:

    Developing Cross Platform Apps with PhoneGap: Part 2, Android | Palm Developer Center Blog
  2.    #2  
    Developing Cross Platform Apps with PhoneGap: Part 3, iOS

    Posted: 10 Sep 2010 11:50 AM PDT
    Setting up PhoneGap to work with Xcode®

    In this tutorial, we will take the Stars app developed in Part One for webOS™, and in Part Two for Android™, and port it to iOS™ using PhoneGap as well.

    To start with, if you’re going to use PhoneGap to create iOS apps, you will need a Mac running Apple’s MacOS X, and have their Xcode® toolset and iOS SDK installed. If you don’t already have these, you can find them here. Install the SDK/Xcode normally, then come back!

    In order to get PhoneGap for iPhone set up properly, you really need to install PhoneGap via Git. This implies that you’ll need Git installed as well. A nice installer can be found here, if you don’t already have it.

    If you have installed PhoneGap already, but not using Git, we need to do a little cleanup, then reinstall. Don’t worry, this won’t affect any other parts of the PhoneGap installation.

    1. Go to the PhoneGap directory.
    2. Delete the phonegap-iphone directory.
    3. From Terminal, run the following commands:

    git clone git://github.com/phonegap/phonegap-iphone.git
    cd phonegap-iphone
    git submodule init
    git submodule update
    make
    open PhoneGapLibInstaller.pkg

    4. After installing PhoneGap, we need to run the updater:

    chmod 755 update_test.sh
    ./update_test.sh

    Now, you’re ready to run Xcode.

    1. Start Xcode and select “File -> New Project…”
    2. Under “User Templates,” click on “PhoneGap,” then double-click on the “PhoneGap-based Application” icon.
    3. Find a good spot for the project, create a directory, and give your project a name. I created a directory called “stars-iphone” and called the project “stars.”
    4. In the resulting project window, you’ll notice that the “Plugins” directory listing is red. That’s because the project template doesn’t create it. So go into Finder and create a directory under “stars” (in this case) called “Plugins”.
    5. There are a couple of configuration items that need to be set up next:
    1. From the “Project” menu, select “Edit Project Settings.”
    2. Click on the “Build” tab.
    3. If you are running the latest version of Xcode, you will likely find that “Base SDK” is set to “iPhone Simulator 3.0 (missing).” Change “Base SDK” to “iPhone Simulator 4.0.”
    4. Scroll down and find “iPhone OS Deployment Target,” and change that to “iPhone OS 3.2.”
    5. Click on the “General” tab.
    6. Change the setting for “Base SDK for All Configurations” to “iPhone Simulator 4.0.”
    7. Close the “Project Settings” window.
    8. From the “Project” menu, change “Set Active SDK” to “Simulator.”
    6. At this point, you can click on the project “Build and Run” button. The iPhone simulator should start, and you should see a blank PhoneGap app. Now we’re ready to add the Starfield code.
    7. Copy the file Starfield.jsjsjs $from$ $one$ $of$ $the$ $previous$ $projects$ $to$ $the$ $stars$/$www$ $directory$ ($where$ $index$.$html$ $is$ $located$).
    8. Uncomment the desired CSS.
    9. Add the reference to Starfield.jsjsjs.
    10. Add the body code to invoke the canvas.

    <div id="myapp">
    <h2>Star Field</h2>
    <h3>tap to start</h3>
    <canvas id="svgCanvas" width="320" height="320" onclick="starfieldStart()"></canvas>
    </div>

    11. Press “Build and Run,” acknowledging that it’s okay to stop the running app, if you did the test run above.

    With any luck, you have a running app now!

    Conclusion

    We hope you’ve enjoyed this brief look at cross-platform development. Stay tuned for more articles on this topic in the future!

    Part One: PhoneGap on webOS
    Developing Cross Platform Apps with PhoneGap: Part 1 | Palm Developer Center Blog

    Part Two: PhoneGap on Android
    Developing Cross Platform Apps with PhoneGap: Part 2, Android | Palm Developer Center Blog

    Developing Cross Platform Apps with PhoneGap: Part 3, iOS | Palm Developer Center Blog
  3. #3  
    I am using the following simple code but its not working.

    Here is the full code that I am using:
    <!DOCTYPE HTML>
    <html>
    <head>
    <title>Contact Example</title>

    <script type="text/javascript" charset="utf-8"
    src="phonegap-0.9.3.jsjsjs&$quot$;&$gt$;&$lt$;/$script$&$gt$;
    <script type="text/javascript" charset="utf-8">

    function onLoad() {
    document.addEventListener("deviceready", onDeviceReady, false);
    }

    function onDeviceReady() {
    var element1 = document.getElementById('myname');
    element1.innerHTML = "Ritesh";

    var element2 = document.getElementById('deviceProperties');
    element2.innerHTML = device.name ;

    }

    </script>
    </head>
    <body onload="onLoad()">
    <p id="myname">Some text here</p>
    <p id="deviceProperties">Loading device name</p>

    </body>
    </html>


    And here is the console log:
    [2011-02-15 10:45:51 - MyPhonegapAppL1] Android Launch!
    [2011-02-15 10:45:51 - MyPhonegapAppL1] adb is running normally.
    [2011-02-15 10:45:51 - MyPhonegapAppL1] Performing com.ex.L1.MyApp
    activity launch
    [2011-02-15 10:45:51 - MyPhonegapAppL1] Automatic Target Mode: using
    existing emulator 'emulator-5554' running compatible AVD 'HelloAvd'
    [2011-02-15 10:45:51 - MyPhonegapAppL1] WARNING: Application does not
    specify an API level requirement!
    [2011-02-15 10:45:51 - MyPhonegapAppL1] Device API version is 9
    (Android 2.3.1)
    [2011-02-15 10:45:51 - MyPhonegapAppL1] Uploading MyPhonegapAppL1.apk
    onto device 'emulator-5554'
    [2011-02-15 10:45:52 - MyPhonegapAppL1] Installing
    MyPhonegapAppL1.apk...
    [2011-02-15 10:45:55 - MyPhonegapAppL1] Success!
    [2011-02-15 10:45:55 - MyPhonegapAppL1] Starting activity
    com.ex.L1.MyApp on device emulator-5554
    [2011-02-15 10:45:56 - MyPhonegapAppL1] ActivityManager: Starting:
    Intent { act=android.intent.action.MAIN
    cat=[android.intent.category.LAUNCHER] cmp=com.ex.L1/.MyApp }


    But its not working. All I see is -
    "Some text here
    Loading device name"
    And then the application exits. Can you please help me figure out?
    Thanks so much in advance.

    PS - I am using Eclipse/Phonegap on windows

Posting Permissions