Some PhoneGap samples

This post is more than 2 years old.

Yesterday I gave a presentation on PhoneGap. In that presentation I had a few samples that I'd like to share. This isn't anything too exciting, and doesn't cover as much as "Mega" project, but if you are looking for some small samples to play with, these may be of use. The examples cover:

  • Camera
  • Compass
  • Contact Search
  • General Device (shows basic device+connection info)
  • Geolocation (also makes use of Google Static Maps)
  • jQuery Mobile (super basic, mainly just shows how it looks)

All the projects may be found in the zip attached to this entry. Does it make sense for me to put these in Github?

Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by 420 Colorado posted on 11/21/2011 at 3:23 AM

Yes, post the examples on GitHub

Comment 2 by Piyush posted on 11/21/2011 at 6:53 AM

Will u upload the presentation slides

Comment 3 by Raymond Camden posted on 11/21/2011 at 7:36 AM

@Piyush - the slides were pretty simple, mainly me explaining what you would get at I spent most of my time showing the code examples.

Comment 4 by Mikel posted on 11/21/2011 at 6:14 PM

Thanks Ray. It is always great to have some good examples!

Comment 5 by Mikel posted on 11/22/2011 at 7:15 PM

I've done some "Googling" but haven't found a really good solution yet. Have any of you had any luck configuring a splash screen and changing the icon for a app from the default icon?

Comment 6 by Raymond Camden posted on 11/22/2011 at 7:34 PM

For the splash screen, it is kinda documented, but not at PhoneGap, rather on Android's docs, which makes sense.

Do not take this for gospel truth, but it worked for me: Make your image, then drop it in res/drawable-*. Ie, a copy in each. I believe you are supposed to use different DPIs, but I didn't bother. Then, in your main activity Java file, do something like so:

public void onCreate(Bundle savedInstanceState) {
super.setIntegerProperty("splashscreen", R.drawable.splash);

The 700 is the # of milliseconds to let the splash screen wait around.

Comment 7 by Mikel posted on 11/23/2011 at 12:06 AM

Your example worked like a champ! Thanks!

Comment 8 by Mikel posted on 11/24/2011 at 1:34 AM

My first app is built and running on my phone! Wow!! Thanks again.

Comment 9 by Raymond Camden posted on 11/24/2011 at 1:44 AM

Thank the PhoneGap folks. :)

Comment 10 by Aleksey posted on 12/27/2011 at 8:35 PM

Hello Ray,

Can you recommend any good solution (some model) for mobile site security which build with PhoneGap? I've done an lot of secured sites on CF and now just interesting how to rebuild some of them to mobile versions. I know I can use XHR requests to server's CFC and get results from there. But what after that? Store results into cookie scope is not looking so secure.
Any ideas?

Comment 11 by Raymond Camden posted on 12/27/2011 at 8:43 PM

If you make a call to a remote CFC and it uses the session scope to mark you as online, any future XHR requests from your PG app will _also_ have those session variables.

Thst's it. :) It's really that simple.