代码:
String msg = "";
try {
if (gcm == null) {
gcm = GoogleCloudMessaging
.getInstance(OrfografApplication.this);
}
String senderId = Constants.GCM_SENDER_ID;
GCM_REGISTRATION_ID = gcm.register(Constants.GCM_SENDER_ID);
msg = "Device registered, registration id="
+ GCM_REGISTRATION_ID;
setRegistrationId(OrfografApplication.this,
GCM_REGISTRATION_ID);
} catch (IOException ex) {
Log.w(TAG, ex.getMessage());
msg = "Error :" + ex.getMessage();
}
return msg;
异常消息SERVICE_NOT_AVAILABLE
在 logcat 中: W/GCM(749): DIR: /data/data/com.google.android.gms/app_APP /data/data/com.google.android.gsf
它运行良好,但在 8 月 23 日停止。