minimal changed required to reuse CloudTasks Demo

57 views
Skip to first unread message

Yoav

unread,
May 20, 2011, 9:33:49 AM5/20/11
to android-c2dm
Hi,
I tried to reuse the CloudTasks demo which was presented recently on
Google I/O (http://code.google.com/p/cloud-tasks-io/) and I got the
following error on the server side:

[WARN] Got error response from Google datamessaging endpoint:
NotRegistered

No massage was obtained in the client.

way to reproduce:

create and register user to be used as Sender. myu...@gmail.com
install the news eclipse plugin
validate that the new user works fine using the sample application
download the CloudTasks code
Change in the cloudtasks-android two values (a) APP_NAME =
"MyAppName" (b) SENDER_ID = "myu...@gmail.com"
In the project properties change "Project Build Target" to Google APIs
10
Create AVD for Google APIs Traget
launch the emulator
sign in to the user acount - myu...@gmail.com
launch the web server and the Android application using "Debug as" >
"Local App Engine Connected Android Application"
in the Emulator press menu to get the ClousTasks menu
select accounts
Select Connect
wait for notification that "myu...@gmail.com" is registered
add tast from the emulator or browser and get "[WARN] Got error
response from Google datamessaging endpoint: NotRegistered"

What did I miss?
Thanks!

Davy

unread,
May 20, 2011, 11:30:05 AM5/20/11
to android-c2dm
Hi Yoav,

I didn't try your protocol, but it seems that you are not registered
to C2DM.
Are you sure that the e-mail address you use myu...@gmail.com is
registered to C2DM service.
If not, you can sign up from here: http://code.google.com/android/c2dm/signup.html

Let me know if this solves your issue.

Michel Jonker

unread,
May 20, 2011, 2:42:21 PM5/20/11
to android-c2dm
Hi i have the same problem and i am registered.
See my thread from 2days ago

abdulw...@gmail.com

unread,
May 20, 2011, 3:17:53 PM5/20/11
to androi...@googlegroups.com
Thats means your device is not registered with the third party application server...while sending message from server to your device..it will always ask for the unique registration id ...in you case which is not store it in server...plz do check again

Sent from my Nokia phone

Yoav

unread,
May 22, 2011, 12:46:18 AM5/22/11
to android-c2dm
1. I checked it three times
2. Using the same SENDER in the sample application works fine
3. Apparently, application do manage to go throught the registration
part (get notification that application was registered) and I get
error just with the messages that contains the data (tasks)

Thanks,
Yoav

On May 20, 10:17 pm, "abdulwahee...@gmail.com"

abdulw...@gmail.com

unread,
May 22, 2011, 4:11:31 AM5/22/11
to androi...@googlegroups.com
Check waheedtechblog.blogspot.com for server code..

Yoav

unread,
May 22, 2011, 3:50:17 PM5/22/11
to android-c2dm
Thanks! nice sample.
Nevertheless, the CloudTasks is better starting point for my
application and I expect it to work as it was presented in GoogleIO. I
didn't touch nothing besides changing the SENDER_ID to another
legitimate tested ID and changing the name of the application and it
is broken. :(
So,
Googlers,please help!
http://bradabrams.com/2010/08/why-google-cares-about-developers/
Thanks,
Yoav

On May 22, 11:11 am, "abdulwahee...@gmail.com"

Brad8711

unread,
May 24, 2011, 4:58:50 AM5/24/11
to android-c2dm
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 22, 9:50 pm, Yoav <yol...@gmail.com> wrote:
> Thanks! nice sample.
> Nevertheless, the CloudTasks is better starting point for my
> application and I expect it to work as it was presented in GoogleIO. I
> didn't touch nothing besides changing the SENDER_ID to another
> legitimate tested ID and changing the name of the application and it
> is broken. :(
> So,
> Googlers,please help!http://bradabrams.com/2010/08/why-google-cares-about-developers/

Yoav

unread,
May 24, 2011, 9:04:38 AM5/24/11
to android-c2dm
Hi Brad.

Thank!

Regarding your eclipse configuration: did you try using the built-in
"Debug as">"Local App Engine Connected Android Application"?
for me it worked fine out of the box...

Did you do anything such as changing values in setup.java to run
CloudTasks? What SENDER_ID did you use? Did you change the
APP_NAME? did the SENDER_ID matched the working google
accounts setup on the phone?

Thanks,
Yoav

Bradly Swart

unread,
May 24, 2011, 9:41:12 AM5/24/11
to androi...@googlegroups.com
Hi Yoav,

That was the first thing I tried :)

The APP_NAME is the name you used for your application when signing up for App Engine,i.e https://" + APP_NAME + ".appspot.com.
 SENDER_ID should be setup us the role account, i.e. the account that you used to sign up for C2DM service.

One thing to note though is that the user account you setup on the phone should not be the same as the role account used to sign up for the services.
So what I done was create a new google account specifically for my app, and used that to sign up for the various Google services. Otherwise you do run into some funky issues, like the 401/400 errors.

Cheers.

Yoav

unread,
May 26, 2011, 7:09:03 AM5/26/11
to android-c2dm
Thanks!
Unfortunately, it didn't work for me. I already tried all the
combinations of role accounts and phone accounts.
Nevertheless, I do not understand how can things work for any account
other that the roll account.
On the server, the code that sends the massage uses the current user
as the sender:

http://code.google.com/p/cloud-tasks-io/source/browse/trunk/CloudTasks-AppEngine/src/com/cloudtasks/server/SendMessage.java

public class SendMessage {

private static final Logger log =
Logger.getLogger(SendMessage.class.getName());

public static String sendMessage(ServletContext context, String
recipient, String message) {
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
String sender = "nobody";
if (user != null) {
sender = user.getEmail();
}
log.info("sendMessage: sender = " + sender);
log.info("sendMessage: recipient = " + recipient);
log.info("sendMessage: message = " + message);
...


Any idea?

Yoav

Bradly Swart

unread,
May 26, 2011, 9:06:48 AM5/26/11
to androi...@googlegroups.com
Quick question, is this only when you are trying to debug locally, and have you tried publishing the app to AppEngine and going from there?
Once I had uploaded my project and tested live it worked, and thats where I started figuring things out from.

Yoav

unread,
May 27, 2011, 4:53:20 AM5/27/11
to android-c2dm
I HAVE DONE IT!!!.

I figured out that I might have to tell the server that
the app_name was changes. I finally found the proper
configuration file: appengine-web.xml.

In addition, there is a token file used by the server for
doing the C2DM messaging. So, I generated proper token file
(that fits to MyApplication name) by creating new project
in the eclipse using MyApplication as project name from
which I took the token file (dataMessagingToken.txt).

Thanks everyone and I hope this thread will help other.

[The worst thing I had to pass in this research is moving to
work with clean environment on my wife's MAC ]

On May 26, 4:06 pm, Bradly Swart <bsw...@colesolutions.net> wrote:
> Quick question, is this only when you are trying to debug locally, and have
> you tried publishing the app to AppEngine and going from there?
> Once I had uploaded my project and tested live it worked, and thats where I
> started figuring things out from.
>
>
>
>
>
>
>
> On Thu, May 26, 2011 at 1:09 PM, Yoav <yol...@gmail.com> wrote:
> > Thanks!
> > Unfortunately, it didn't work for me. I already tried all the
> > combinations of role accounts and phone accounts.
> > Nevertheless, I do not understand how can things work for any account
> > other that the roll account.
> > On the server, the code that sends the massage uses the current user
> > as the sender:
>
> >http://code.google.com/p/cloud-tasks-io/source/browse/trunk/CloudTask...
Reply all
Reply to author
Forward
0 new messages