I directly copied all three C2DM classes into my project from Google Code's ChomeToPhone extension (http://code.google.com/p/chrometophone/.../c2dm), and then modified my Manifest per the instructions on the Android Cloud to Device Messaging Framework page. When I run my program, I get the following error. I can't figure out what's going on or why:
06-12 18:50:43.243: ERROR/AndroidRuntime(923): FATAL EXCEPTION: main
06-12 18:50:43.243: ERROR/AndroidRuntime(923): java.lang.RuntimeException: Unable to instantiate receiver com.name.asdf.C2DMBaseReceiver: java.lang.InstantiationException: com.name.asdf.C2DMBaseReceiver
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2789)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at android.app.ActivityThread.access$3200(ActivityThread.java:125)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at android.os.Handler.dispatchMessage(Handler.java:99)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at android.os.Looper.loop(Looper.java:123)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at java.lang.reflect.Method.invokeNative(Native Method)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at java.lang.reflect.Method.invoke(Method.java:521)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at dalvik.system.NativeStart.main(Native Method)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): Caused by: java.lang.InstantiationException: com.name.asdf.C2DMBaseReceiver
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at java.lang.Class.newInstanceImpl(Native Method)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at java.lang.Class.newInstance(Class.java:1429)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2780)
06-12 18:50:43.243: ERROR/AndroidRuntime(923): ... 10 more
C2DMBaseReceiver
is an abstract class, you can't instantiate it. You should subclass C2DMBaseReceiver
and provide your own implementation. Then register that class in your manifest. Note that you should put that class in the root of your package.