0

我试图注册 c2dm,但总是给我这个错误:

05-18 10:48:32.357: D/C2DMRegistrar(225): [C2DMRegistrar.46] 注册: http 错误 400

这是注册方法:

public static final String EXTRA_SENDER = "sender";
public static final String EXTRA_APPLICATION_PENDING_INTENT = "app";
public static final String REQUEST_UNREGISTRATION_INTENT = "com.google.android.c2dm.intent.UNREGISTER";
public static final String REQUEST_REGISTRATION_INTENT = "com.google.android.c2dm.intent.REGISTER";
public static final String LAST_REGISTRATION_CHANGE = "last_registration_change";
public static final String BACKOFF = "backoff";
// public static final String GSF_PACKAGE = "com.google.android.gsf";

public static void register(Context context, String senderId) {
Intent registrationIntent = new Intent(REQUEST_REGISTRATION_INTENT);
// registrationIntent.setPackage(GSF_PACKAGE);
registrationIntent.putExtra(EXTRA_APPLICATION_PENDING_INTENT,
    PendingIntent.getBroadcast(context, 0, new Intent(), 0));
registrationIntent.putExtra(EXTRA_SENDER, senderId);
context.startService(registrationIntent);
}

我用GSF_PACKAGE和 不测试它GSF_PACKAGE

SenderId是邮箱账号XXXX@XXX.com,我收到了这样的邮件:

From: noreply@google.com [mailto:noreply@google.com] 

Thank you for your interest in Android Cloud to Device Messaging (C2DM).
We've accepted your application into the trial group. The Google account
you requested as the sender account for your application:

 XXXX@XXX.com

我在 AVD 模拟器中,并且我在模拟器中也有一个谷歌帐户。在真正的移动设备中,同样的事情。

我没有接到任何电话C2DMBaseReceiver.onHandleIntent,只显示该错误。

任何想法?

4

1 回答 1

0

您是否通过模拟器设置了您的 Google 帐户,如果没有,请通过设置-> 帐户和同步-> 添加帐户希望这有帮助!!!

于 2012-05-18T11:23:00.267 回答