Я слежу за примером Android c2dm по следующей ссылке:
http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html
Я успешно реализовал клиентскую часть и получил свой регистрационный идентификатор. но у меня есть некоторые проблемы на стороне сервера, используя тот же пример, на самом деле проблема в методе getAuthentification, и я получаю следующее исключение в HttpResponse response = client.execute (post).
java.net.UnknownHostException: www.google.com
Ниже мой код:
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(
"https://www.google.com/accounts/ClientLogin");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("Email","you....@gmail.com"));
nameValuePairs.add(new BasicNameValuePair("Passwd","*********"));
nameValuePairs.add(new BasicNameValuePair("accountType", "GOOGLE"));
nameValuePairs.add(new BasicNameValuePair("source",
"Google-cURL-Example"));
nameValuePairs.add(new BasicNameValuePair("service", "ac2dm"));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(
response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
Log.e("HttpResponse", line);
if (line.startsWith("Auth=")) {
Editor edit = prefManager.edit();
edit.putString(AUTH, line.substring(5));
edit.commit();
String s = prefManager.getString(AUTH, "n/a");
Toast.makeText(this, s, Toast.LENGTH_LONG).show();
}
}
} catch (IOException e) {
e.printStackTrace();
}
Пожалуйста, помогите мне? Ваша помощь будет очень ценной. Спасибо,