Using C2DM to receive gmail message notifications

by Tom » Mon, 16 Aug 2010 13:49:55 GMT

Sponsored Links
 I'd like my app to receive notification when new messages arrive in my
gmail account.
I realize that the Android gmail client does not broadcast
notification when it receives messages. Instead I want to utilize the
gmail server's Cloud to Device Messaging capabilities to do this. I
read the article at - the only 
"missing piece" for me is to understand how my app sends a
registration ID to the gmail server. Can someone please point me in
the right direction?



Other Threads

1. findViewById returns null for package private classes

This one took me a long time to figure out, so I thought I'd share it.
I have a custom View in the same package as my Activity, and the View
was a package private (the default access - no access modifier) class.
There wasn't anything in the log about not being able to create this
class, but calling findViewById on its id returned null. Changing the
access modifier on the class worked - now findViewById returns the

For clarity, I had something like:
    class MyView extends View {...}
changing it to
    public class MyView extends View {...}
got around the problem of Activity.findViewById(int) returning null.


2. Authenticating to google services

My app needs the user to have a google account for certain APIs I want
to use.  However, I'd expect that the user won't want to input their
credentials every time they use it, so how should I handle this?

Is there an existing service or application built in to Android that
will store a user's account details (or just an auth token returned)
from the last time they logged in?

I guess I'm trying to not reinvent the wheel, as I imagine many other
Android apps need google accounts and from what I've read about the
whole INTENT process, I thought perhaps my app could register an
intent to authenticate to google services, and an intent receiver
might already exist to pick this up....



3. WiFi Ad-hoc networks in android??

4. 1.0r1 Position set but map does not show up

5. how to keep touch event

6. List View Issue

7. Permission denial when i try to modify system settings