PhoneGap+Android - Newbie seeking help from guru's...

5 views
Skip to first unread message

bixbarton

unread,
Feb 4, 2010, 12:18:12 PM2/4/10
to phonegap
Hi guys. I'm investigating writing cross-platform apps for the iPhone
and Android. Since I don't have a Mac (yet), I'm investigating from
the Android point of view. I've tried Titanium, took a lot of
facepalming, but managed to get somewhere.

So now investigating PhoneGap - using 0.8.2

I've loaded up the environment and built the demo app, deployed to
Android emulator. I recognise not everything works, due to it being an
emulator, but Beep causes it to quit the app.

When I look behind the scenes to see why beep doesn't work, it looks
like the call to DroidGap.beep(count); is causing the crash. When I
look further I can't find an implementation of beep in the
DroidGap.java, infact a lot of things seem to be missing.

I will continue to investigate, and see if 0.8.3 or 0.9.0 have more
implementations for DroidGap.beep and the other missing stuff.

But...

Do you have any good example code for PhoneGap+Android apps?
Is there some good documentation of the APIs, what is implemented,
what isn't?

Any help would be much appreciated!

Krs
Chris

filmaj

unread,
Feb 4, 2010, 1:07:18 PM2/4/10
to phonegap
Hey Chris,

Which version of Android are you targeting? We are aware of problems
with Android 2.0+ but are hard-pressed to be able to resolve them due
to us not being able to get an Android 2.0 device (thus is the curse
of Canada).

Have a look at my repository: http://github.com/filmaj/phonegap-android,
fork or download the latest source from it and give that a shot. The
new build script should make things easier too (check out the readme
for instructions).

Hope that helps,
Fil Maj
Web Software Engineer
Nitobi

bixbarton

unread,
Feb 4, 2010, 3:47:17 PM2/4/10
to phonegap
Hmm, not sure what I'm doing wrong here. But I pulled down the files,
dropped them into the c:\phonegap\android folder on my machine

But when I run and deploy, what comes up in the emulator is a mobile
version of the PhoneGap website...

filmaj

unread,
Feb 4, 2010, 4:53:12 PM2/4/10
to phonegap
Chris,

If you look at standalone.java in the native code, there is this bit
of code:

try {
f = c.getField("url");
i = f.getInt(f);
uri = this.getResources().getString(i);
} catch (Exception e)
{
uri = "http://www.phonegap.com";
}

Looks something is triggering the exception and forcing the URL to
point to phonegap.com. Do you have a 'url' property in your res/values/
strings.xml that points to the initial URL?

Edit: Looks like a commit to the repository recently removed that
entry by default from the strings.xml. Add this to your strings.xml:

<string name="url">file:///android_asset/www/index.html</string>

That should point, by default, to the index.html present in the www
directory.

Chedstone

unread,
Feb 9, 2010, 3:10:19 AM2/9/10
to phonegap
this worked for me on my moto droid 2.0.1.

The only things that aren't working are the
getlocation,platform,version,uuid and get phones contacts.

I am writing my app in java right now but would rather use something
like this to deploy accross platforms.

any idea when a 2.0.1 or even 2.1 compatible version might be
available?

Roy

bixbarton

unread,
Feb 9, 2010, 7:45:12 AM2/9/10
to phonegap
Thanks Fil

That got it working again.

I'm targetting 1.6 at the moment, using the emulator only - we're
buying a device asap.

I notice your demo wants to work in 2.0, as I get errors, one of which
mentioning "Eclair" if I try to use 1.6.

However the Platform, Version and UUID still don't get populated.

Also, when the redirection to the PhoneGap website happened, I noticed
the featured PG apps. But they all appear to be iPhone apps, none are
Android.

bixbarton

unread,
Feb 9, 2010, 10:18:09 AM2/9/10
to phonegap
Fil

Is there any decent documentation on the API?

I know from using Titanium, there is documentation on what all the
calls are, how to use them, sample code.

But PhoneGap seems to be missing this.

filmaj

unread,
Feb 9, 2010, 1:34:05 PM2/9/10
to phonegap
Hey guys,

bixbarton: we hear you, documentation is lacking and so is sample
code. We are doing our best to address this issue. Nitobi has a new
hire (Steve, you may seem him around here!) who is spearheading the
documentation work and wiki clean up.

In general, for Android 2.0+ support, Nitobi just ordered a couple of
Nexus One's, which we expect in the office sometime within the next
week. Once we have those babies, we can really get down to having a
proper and working version of PhoneGap for Android 2.0+. Can't wait to
get my hands on that thing :)

As for it not working on 1.6, I know for sure that my repository does
on my Google G1. Are you sure the build script ran properly and
without any errors? It may be that the JavaScript files are not
getting concatenated into a fresh phonegap.js, which is required to
have your PhoneGap Android app working.

Steve Gill

unread,
Feb 9, 2010, 1:40:00 PM2/9/10
to filmaj, phonegap
Check out docs.phonegap.com and wiki.phonegap.com
I am slowly chipping away at both of these and more useful information will be added soon. Take a look and see if any of the information on there can help you out.

-Steve

--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com

bixbarton

unread,
Feb 11, 2010, 7:14:27 AM2/11/10
to phonegap
Hi Fil, I didn't run the build script - probably the reason for
troubles.

But I've not had much success getting it to build on Windows.

I've installed ANT. What do I need to do next?

Reply all
Reply to author
Forward
0 new messages