Android + App Engine: A Developer's Dream Combination

525 views
Skip to first unread message

Brad8711

unread,
May 23, 2011, 9:12:23 AM5/23/11
to android-c2dm
Hi Everyone,

So after pondering a while about how exactly to go about building my
Android app, I came across the Android + App Engine: A Developer's
Dream Combination video and is exactly what I need!

Now in the video and the tutorials I've seen everything gets up and
running right from the start after creating a new app engine linked
project.
When I try and run it on the android emulator I get a "WARN/
DeviceRegistrar(489): Failure, got :Connection to http://127.0.1.1:8888
refused"
I have selected the android app to use the Google API's version 8 for
2.2 and the GWT / App Engine project is set to use the 2.4 plugin and
1.5 GAE SDK's.

I have also tried this on my HTC Desire in debug mode, as well as
changing the URL to http://127.0.0.1:8888 as thats where the GWT part
of the project resolves to.

Also to note is that using the sample application from the browser
works, just that the Android App doesn't. I have my google account
setup on the android emulator I setup, and can retrieve my gmail and
internet works from the emulator.

I can't seem to figure out why this is happening and I cannot find any
help with regards to this problem anywhere on the internet.
Any help would be much appreciated.

Yoav

unread,
May 24, 2011, 1:04:52 AM5/24/11
to android-c2dm
Hi,

Problem doesn't seems to be related to the specific application you
run.
Apparently it is related to the eclipse configuration. Try first to
run simpler
sample application.
Once you are sure the IDE is OK try to run the sample application
which
is built in the plugin
(new->project-> Android -> App Engine Connected Android App) to that
your
user is really registered in the c2dm system.
Now you can try running the dream application.

Good luck!
Yoav

If all goes well and you manage to run it, please let me know here:
http://groups.google.com/group/android-c2dm/browse_thread/thread/f32d848459fb5e9d




On May 23, 4:12 pm, Brad8711 <brad8...@gmail.com> wrote:
> Hi Everyone,
>
> So after pondering a while about how exactly to go about building my
> Android app, I came across the Android + App Engine: A Developer's
> Dream Combination video and is exactly what I need!
>
> Now in the video and the tutorials I've seen everything gets up and
> running right from the start after creating a new app engine linked
> project.
> When I try and run it on the android emulator I get a  "WARN/
> DeviceRegistrar(489): Failure, got :Connection tohttp://127.0.1.1:8888
> refused"
> I have selected the android app to use the Google API's version 8 for
> 2.2 and the GWT / App Engine project is set to use the 2.4 plugin and
> 1.5 GAE SDK's.
>
> I have also tried this on my HTC Desire in debug mode, as well as
> changing the URL tohttp://127.0.0.1:8888as thats where the GWT part

Brad8711

unread,
May 24, 2011, 5:01:17 AM5/24/11
to android-c2dm
I have replied to the thread that you asked, for the sake of keeping
this info together I am also going to add my solution to this thread
in case someone stumbles across it.

Thanks!

************************
Hi Yoav, and List/Group.

Thanks for your response to my question on getting the C2DM example
working, so I'm replying here like you asked if I managed to get it
right.
Although I have only read your reply now, I did manage to figure it
out in the early hours this morning :)

To fill the rest of the group in, I have been having major issues
trying to get the sample app engine connected android project working.
I could not register my android device (using AVD and my HTC mobile)
to the C2DM service when debugging locally, although deploying the app
to AppEngine and accessing it as a production environment worked.

From what I read you have to make sure that you are using Google API's
level 8 for 2.2 (Not Android SDK) on your android project, and the
ADV, as a minimum. As well as have a working google accounts setup on
the phone in Settings -> Accounts. This was the only change required
for me to run the sample application that gets built for you in
Eclipse when you start a new AppEngine connected Android product, an
from what I have tested also gets the CloudTasks running on a local
dev environment.

You were correct in saying that it had to do with my setup, more
specifically it has to do with the App Engine DevAppServer
configuration in Eclipse.
The root cause being that app engine internal server is set to bind
only to the localhost, now obviously if you try and access 127.0.0.1
from the android device its going to point to the device itself, and
not your dev environment, so to change this you need to change the
startup arguments and add the "-bindAddress 0.0.0.0". Right-click on
your project -> Debug As -> Debug Configuration, select your AppEngine
project/sample application and select the Arguments tab, in the
"Program Arguments" edit box is where you edit the startup arguments.
The port is already set, so you have to add the BindAddress argument,
I added it in after the port so that part looked like this "-port 8888
-bindAddress 0.0.0.0".

This will bind the AppEngine server to all addresses and not just
localhost.
Then to access your dev/debug app engine server by its ethernet IP or
for some reason using 10.0.2.2 to connect to my local server worked
from Android Virtual Device, I read somewhere that it creates that
virtual IP, although I am still to find any documentation on that...

For Interest sake I am running Eclipse Helios version, with GPE 2.4
beta, GWT 1.5, and the latest android SDK's. Ubuntu 10.10 64-bit OS.

On May 24, 7:04 am, Yoav <yol...@gmail.com> wrote:
> Hi,
>
> Problem doesn't seems to be related to the specific application you
> run.
> Apparently  it is related to the eclipse configuration. Try first to
> run simpler
> sample application.
> Once you are sure the IDE is OK try to run the sample application
> which
> is built in the plugin
> (new->project-> Android -> App Engine Connected Android App) to that
> your
> user is really registered in the c2dm system.
> Now you can try running the dream application.
>
> Good luck!
> Yoav
>
> If all goes well and you manage to run it, please let me know here:http://groups.google.com/group/android-c2dm/browse_thread/thread/f32d...
>
> On May 23, 4:12 pm, Brad8711 <brad8...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi Everyone,
>
> > So after pondering a while about how exactly to go about building my
> > Android app, I came across the Android + App Engine: A Developer's
> > Dream Combination video and is exactly what I need!
>
> > Now in the video and the tutorials I've seen everything gets up and
> > running right from the start after creating a new app engine linked
> > project.
> > When I try and run it on the android emulator I get a  "WARN/
> > DeviceRegistrar(489): Failure, got :Connection tohttp://127.0.1.1:8888
> > refused"
> > I have selected the android app to use the Google API's version 8 for
> > 2.2 and the GWT / App Engine project is set to use the 2.4 plugin and
> > 1.5 GAE SDK's.
>
> > I have also tried this on my HTC Desire in debug mode, as well as
> > changing the URL tohttp://127.0.0.1:8888asthats where the GWT part

Mark

unread,
Jun 5, 2011, 2:29:56 PM6/5/11
to android-c2dm
Hello,

I added the -bindAddress 0.0.0.0 entry to the program arguments. But
somehow it still tells me, that the server runs http://localhost:8888/
and I still get 06-05 12:27:34.950: WARN/DeviceRegistrar(2050):
Failure, got :Connection to http://127.0.1.1:8888 refused ...
Have I overread something? The software versions and the OS are the
same as Brad's.

Do you have any other idea?

Thanks, Mark
> > > changing the URL tohttp://127.0.0.1:8888asthatswhere the GWT part

strinder

unread,
Jul 7, 2011, 10:21:28 AM7/7/11
to android-c2dm
Hi all - I seem to be getting the same here and adding the -
bindAddress 0.0.0.0 hasn't helped:

07-07 14:59:36.542: WARN/DeviceRegistrar(577): Failure,
got :Connection to http://127.0.1.1:8888 refused.

My AVD and android project build target are both set to Google APIs
2.2 Level 8 and I have a valid google login on the emulator.

Any advice/suggestions appreciated.

Thanks!

Steven L.

unread,
Jul 7, 2011, 2:09:49 PM7/7/11
to androi...@googlegroups.com
I got mine to work a week back.  Here is what I did:

1.) Create an account with app engine (https://appengine.google.com/)
2.) Create an app (lets say app name is myapp)
3.) Sign up for C2DM here http://code.google.com/android/c2dm/signup.html
     (The only thing seems to matter is the role email address.  I seen people refer to this as sending address.  There is some confusion here but the way I understand it is Your phone should have an existing google account like j...@gmail.com.  You set this up in the settings > account and this should be a google account not a enterprise account like outlook/exchange server.  You only get the google account option if your target device is based on Google APIs.  I theory, you should be able to have many phone with different email/google accounts but only one role/sender email like my.c2dm...@gmail.com for example.  I was told my google person that the package name does not matter at this point and I found that to be true through testing.  I think I read somewhere that said package name is the same as the app name which you will create in app engine.  Since it does not matter I did not play with it.  I could try com.appspot.myapp or myapp as package name)
3.) Use AVD and set target device to Google APIs 2.2 Level 8 (There is an Android 2.2 embedded in there)
4.) Select Skin > Built-in to WQVGA432 (I run on a small laptop, 432 is a good screen size for me.  Other wise emulator is too big)
5.) In Eclipse go to File > New > Project > Google > App Engine Connected Android Project just like the man said in the nice video: http://www.youtube.com/watch?v=M7SxNNC429U
     Again, I have not found the package name made a difference but I would match my package name with the app name just to be save.
6.) Here I do a little different than the demo.  I actually deployed my app to app engine by clicking on the little engine icon (BTW, you should have installed all the plugins APIs, android stuff into eclipse)
7.) Modify the Setup.java file under src > package name > Setup.java and the stuff I modified are APP_NAME = , PROD_URL = , SENDER_ID = to match what I deployed to app engine.  For example APP_NAME = myapp , PROD_URL = "https://" + APP_NAME + ".appspot.com", SENDER_ID = my.c2dm...@gmail.com
8.) Right click on the android project > Debug As > Remote App Engine Connected Android Application (I debug in remote connected app because my laptop is slow and I have not spent enough time getting the local version to work yet.  But at least this is a good way to test C2DM.  BTW, I was told to wait a few days after sign up for C2DM so I did.)
9.) Assuming your phone or emulator already has an google account, bring you your C2DM app and click on setting > select the account > click connect
10.) Bring up myapp.appspot.com and go from there.


Good luck


Steve
--
Steve Liang's Cell: 510-688-3894

strinder

unread,
Jul 11, 2011, 6:31:04 AM7/11/11
to android-c2dm
Hi Steve - thanks for the comprehensive reply, I will give that a go
but to be honest I can't see why I can't get it working locally as
demoed by the man in the nice video!

Has anyone got it working 'out of the box' just by simply following
the instructions from the blog post at http://bit.ly/n8Yeqk ?

cheers

On Jul 7, 7:09 pm, "Steven L." <stli...@gmail.com> wrote:
> I got mine to work a week back.  Here is what I did:
>
> 1.) Create an account with app engine (https://appengine.google.com/)
> 2.) Create an app (lets say app name is myapp)
> 3.) Sign up for C2DM herehttp://code.google.com/android/c2dm/signup.html
>      (The only thing seems to matter is the role email address.  I seen
> people refer to this as sending address.  There is some confusion here but
> the way I understand it is Your phone should have an existing google account
> like j...@gmail.com.  You set this up in the settings > account and this
> should be a google account not a enterprise account like outlook/exchange
> server.  You only get the google account option if your target device is
> based on Google APIs.  I theory, you should be able to have many phone with
> different email/google accounts but only one role/sender email like
> my.c2dm.serv...@gmail.com for example.  I was told my google person that the
> package name does not matter at this point and I found that to be true
> through testing.  I think I read somewhere that said package name is the
> same as the app name which you will create in app engine.  Since it does not
> matter I did not play with it.  I could try com.appspot.myapp or myapp as
> package name)
> 3.) Use AVD and set target device to Google APIs 2.2 Level 8 (There is an
> Android 2.2 embedded in there)
> 4.) Select Skin > Built-in to WQVGA432 (I run on a small laptop, 432 is a
> good screen size for me.  Other wise emulator is too big)
> 5.) In Eclipse go to File > New > Project > Google > App Engine Connected
> Android Project just like the man said in the nice video:http://www.youtube.com/watch?v=M7SxNNC429U
>      Again, I have not found the package name made a difference but I would
> match my package name with the app name just to be save.
> 6.) Here I do a little different than the demo.  I actually deployed my app
> to app engine by clicking on the little engine icon (BTW, you should have
> installed all the plugins APIs, android stuff into eclipse)
> 7.) Modify the Setup.java file under src > package name > Setup.java and the
> stuff I modified are APP_NAME = , PROD_URL = , SENDER_ID = to match what I
> deployed to app engine.  For example APP_NAME = myapp , PROD_URL = "https://"
> + APP_NAME + ".appspot.com", SENDER_ID = my.c2dm.serv...@gmail.com
> 8.) Right click on the android project > Debug As > Remote App Engine
> Connected Android Application (I debug in remote connected app because my
> laptop is slow and I have not spent enough time getting the local version to
> work yet.  But at least this is a good way to test C2DM.  BTW, I was told to
> wait a few days after sign up for C2DM so I did.)
> 9.) Assuming your phone or emulator already has an google account, bring you
> your C2DM app and click on setting > select the account > click connect
> 10.) Bring up myapp.appspot.com and go from there.
>
> Good luck
>
> Steve
>

strinder

unread,
Jul 11, 2011, 7:56:05 AM7/11/11
to android-c2dm
OK - I got this working.

It seems that for me it was a problem with the emulator trying to
connect to 127.0.1.1 rather than 10.0.2.2. I found this post:
http://bit.ly/nzpQuv and hardcoded http://10.0.2.2:888 as the url
returned by the method getDebugUrl(Context context) in Util.java

This method actually reads the URL from a props file
debugging_prefs.properties but when I changed the value there to
10.0.2.2 it was overwritten with 127.0.1.1 when starting the debugger,
no idea why!

Patrick Jackson

unread,
Jul 11, 2011, 8:51:05 AM7/11/11
to androi...@googlegroups.com

I got this working as you described.  Have you got this to work as a deployed app on an actual device?  I have not been able to do this.

On Jul 7, 2011 2:11 PM, "Steven L." <stl...@gmail.com> wrote:

strinder

unread,
Jul 11, 2011, 10:40:23 AM7/11/11
to android-c2dm
Just to add obviously that should be http://10.0.2.2:8888 not
http://10.0.2.2:888

So the upshot is for me to get this sample working locally on debian I
followed every step as outlined in the blog post http://bit.ly/n8Yeqk
with the only change being:

- change getDebugUrl(Context context) in Util.java by substituting:

return url;

with:

return new String ("http://10.0.2.2:8888");

I'd still like to know why the property file gets overwritten though!

On Jul 11, 1:51 pm, Patrick Jackson <patjackso...@gmail.com> wrote:
> I got this working as you described.  Have you got this to work as a
> deployed app on an actual device?  I have not been able to do this.
> On Jul 7, 2011 2:11 PM, "Steven L." <stli...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages