我正在开发一个应用程序,希望实现推送通知功能。为此,我使用了Google提供的GCM服务。我已在Google控制台上注册了我的项目,并使用项目ID作为GCM注册的senderID。
GCMRegistrar.checkDevice(this); //no error
GCMRegistrar.checkManifest(this); //no error
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, "********"); //after this..
//onError method of GCMIntentService class
//is triggered, there I am printing error
//in log its saying INVALD_SENDER
}
我已在AndroidManifest.xml中给出了所有必需的权限。
我已经参考了以下链接:
1) Android GCM SENDER_ID,如何获取? 2) 在具有两个GCM BroadcastReceivers的应用程序中偶尔收到INVALID_SENDER错误 3) GCM无效发件人错误 4) http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/