0
這裏C2DM SERVICE_NOT_AVAILABLE錯誤是我的代碼:上註冊
// begin the registration process
status.setText("Registering...");
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("register.php");
SharedPreferences settings = getSharedPreferences("settings", 0);
String name = settings.getString("name", "");
String email = settings.getString("email", "");
String password = settings.getString("password", "");
//get C2DM registration ID
Context context = getApplicationContext();
C2DMessaging.register(context, "qasim1iqbal");
String reg_id = C2DMessaging.getRegistrationId(context);
String HTML = "";
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("name", name));
nameValuePairs.add(new BasicNameValuePair("email", email));
nameValuePairs.add(new BasicNameValuePair("password", password));
nameValuePairs.add(new BasicNameValuePair("reg_id", reg_id));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HTML = EntityUtils.toString(response.getEntity());
Toast msg = Toast.makeText(getApplicationContext(), HTML, Toast.LENGTH_LONG);
msg.show();
Intent i = new Intent(getBaseContext(), doneRegisterActivity.class);
startActivityForResult(i, 0);
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
我得到在登記SERVICE_NOT_AVAILABLE錯誤,可能會造成什麼呢?這是一個活動。
我現在正在嘗試使用C2DM,並且在日誌中還看到相同的SERVICE_NOT_AVAILABLE錯誤,以及「DEBUG/C2DMRegistrar(235):[C2DMRegistrar.69] register:http error 404」。我看到你接受了答案,說這可能是服務器呃逆。這東西是否消失了?服務器問題? –
@Mason它實際上是因爲我輸入的電子郵件不是一個有效的電子郵件,解決這個問題後,C2DM工作正常。 – Qasim
啊!同樣在這裏。我已經使用郵件別名註冊,而不是Google帳戶;註冊系統並不在意,但C2DM確實如此。謝謝。 –