即使 GitHub 中的项目有那个字符串,它也不会给您带来任何好处,因为这个 authorizedEntity 对于每个应用程序来说都是独一无二的.Could somebody please help me understand what the gcm_defaultSenderId is in the following code (found in onHandleIntent in RegistrationIntentService.java):InstanceID instanceID = InstanceID.getInstance(this); String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); // [END get_token] Log.i(TAG, "GCM Registration Token: " + token);This is from the Google sample app for implementing GCM into your app, and it doesn't even compile in their app! I'm sure it's something specific to each app. I've already added the GCM API to my application, just don't know what this string is supposed to be! Thanks! 解决方案 Quoting THIS document, where you can find details about that implementation:String authorizedEntity = PROJECT_ID; // Project id from Google Developers ConsoleString scope = "GCM"; // e.g. communicating using GCM, but you can use any // URL-safe characters up to a maximum of 1000, or // you can also leave it blank.String token = InstanceID.getInstance().getToken(authorizedEntity,scope);So as you can see, the first param you should pass to getToken() is the authorizedEntity, which should be your project id from Google Developers :)Even if the project in GitHub had that string, it wouldn't server you any good, as this authorizedEntity is something unique for each app. 这篇关于GCM 默认发件人 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!