我有这段代码:
public void login(View view)
{
new Thread(new Runnable()
{
public void run() {
try {
usuario = txtUser.getText().toString();
clave = txtPassword.getText().toString();
Log.i("User", usuario);
Log.i("Password", clave);
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://myurl.com/myapp/controller/_login.php");
Log.i("Step", "2");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
Log.i("Step", "3");
nameValuePairs.add(new BasicNameValuePair("username", usuario));
nameValuePairs.add(new BasicNameValuePair("clave", clave));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
Log.i("Step", "4");
ResponseHandler<String> responseHandler=new BasicResponseHandler();
Log.i("Step", "5");
String respuesta = httpclient.execute(httppost, responseHandler);
Log.v("Respuesta", respuesta);
threadMsg(respuesta);
}
catch (ClientProtocolException e) {
Log.v("Error", "Error 1 ");
mostrarToast("FAIL");
}
catch (IOException e) {
Log.v("Error", "Error 2");
mostrarToast("FAIL");
}
}
}
最明确的许可
<uses-permission android:name="android.permission.INTERNET" />
这段代码一直工作到昨天,但我正在尝试使用GCM。我试图删除GCM依赖项,但现在这个应用程序在http.execute中失败。
我有备份,但备份现在失败了。尽管我已经删除了进行此注册和所有相关服务的代码,但它仍在尝试在GCM中注册。
如何让此代码再次运行?为什么我的应用程序会继续在GCM中注册?