Wednesday, 23 November 2011

Your First Connect to the Cloud Error: PHONE_REGISTRATION_ERROR

When you set up your new project you added in your role email address as in this image. This is the same role email address that you used to sign up for Android Cloud to Device Messaging. If you haven't done this yet then go to http://code.google.com/android/c2dm/signup.html and fill in the form and wait for the confirmation email before proceeding.

Configure C2DM

You build the projects and launch in Debug for the first time. All Android devices have the concept of a Google email address and password that is usually set up on the first day you have the phone. Thereafter you don't have to supply your email address and password every time you connect to a Google service. However, if you try to connect to the cloud using the role email address that you used to register with C2DM then you'll get the following error:

C2DM Connect to the Cloud Screen

11-23 15:39:11.444: E/C2DM(629): Registration error PHONE_REGISTRATION_ERROR
11-23 15:39:31.584: I/dalvikvm(629): threadid=3: reacting to signal 3
11-23 15:39:31.623: D/dalvikvm(629): threadid=1: still suspended after undo (sc=1 dc=1)
11-23 15:39:31.623: I/dalvikvm(629): Wrote stack traces to '/data/anr/traces.txt'
11-23 15:39:41.677: D/AndroidRuntime(629): Shutting down VM
11-23 15:39:41.677: W/dalvikvm(629): threadid=1: thread exiting with uncaught exception (group=0x409951f8)
11-23 15:39:41.854: E/AndroidRuntime(629): FATAL EXCEPTION: main
11-23 15:39:41.854: E/AndroidRuntime(629): java.lang.RuntimeException: Error receiving broadcast Intent { act=comexample.yourname.UPDATE_UI flg=0x10 } in com.example.yournameActivity$1@41058dd8
11-23 15:39:41.854: E/AndroidRuntime(629):     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:737)
11-23 15:39:41.854: E/AndroidRuntime(629):     at android.os.Handler.handleCallback(Handler.java:605)
11-23 15:39:41.854: E/AndroidRuntime(629):     at android.os.Handler.dispatchMessage(Handler.java:92)
11-23 15:39:41.854: E/AndroidRuntime(629):     at android.os.Looper.loop(Looper.java:137)
11-23 15:39:41.854: E/AndroidRuntime(629):     at android.app.ActivityThread.main(ActivityThread.java:4340)
11-23 15:39:41.854: E/AndroidRuntime(629):     at java.lang.reflect.Method.invokeNative(Native Method)
11-23 15:39:41.854: E/AndroidRuntime(629):     at java.lang.reflect.Method.invoke(Method.java:511)
11-23 15:39:41.854: E/AndroidRuntime(629):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-23 15:39:41.854: E/AndroidRuntime(629):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-23 15:39:41.854: E/AndroidRuntime(629):     at dalvik.system.NativeStart.main(Native Method)
11-23 15:39:41.854: E/AndroidRuntime(629): Caused by: java.lang.NullPointerException
11-23 15:39:41.854: E/AndroidRuntime(629):     at android.app.PendingIntent.getActivity(PendingIntent.java:195)
11-23 15:39:41.854: E/AndroidRuntime(629):     at com.example.yourname.Util.generateNotification(Util.java:120)
11-23 15:39:41.854: E/AndroidRuntime(629):     at com.example.yournameActivity$1.onReceive(yournameActivity.java:81)
11-23 15:39:41.854: E/AndroidRuntime(629):     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)
11-23 15:39:41.854: E/AndroidRuntime(629):     ... 9 more

This is because you are trying to connect without a proper gmail address. If you have connected up your live device, choose another email address such as your personal one to test. If you are using the simulator, you need to go into the Settings and add another google account - again add your personal one. You'll then have success :)

C2DM Contacting server

C2DM Successful response from App Engine

No comments:

Post a Comment