C2DM 注册错误



我试图注册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没有接到任何电话,只显示该错误。

知道吗?

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

最新更新