C2DM: where does C2DMReceiver get instantiated?
I'm trying to develop an android application which uses c2dm services. I've read many tutorials and had a look to the chrometophone example. Seems to be an easy task, but still I开发者_开发百科 can't manage to make things work. The last guide I followed is this one: http://www.johnhawthorn.com/2010/12/android-cloud-to-device-messaging-1/. I really can't understand if I need to create an instance of the class C2DMReceiver or it will be created automatically when the c2dm service will call one of the functions declared in the class, e.g. onRegistered().
C2DMReceiver
is a Service
. You never create your own instances of services.
Some of the Google helper code (C2DMBaseReceiver
) not only provides the superclass for C2DMReceiver
, but also arranges to call startService()
on C2DMBaseReceiver
as needed based on C2DM events.
精彩评论