Hol, I'm creating an android app but I have an error that has me unprepared because I never would have happened this before.
public void UpdateState(final String iddispositivo, final String iduser, final String uubicacion) {
class UpDni extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = ProgressDialog.show(Home.this, "Accediendo", null, true, true);
}
@Override
protected void onPostExecute(String httpResponseMsg) {
super.onPostExecute(httpResponseMsg);
progressDialog.dismiss();
if (httpResponseMsg.equalsIgnoreCase("correcto")) {
Toast.makeText(getBaseContext(), "Proceso exitoso", Toast.LENGTH_LONG).show();
finish();
Intent intent = new Intent(Home.this, Home.class);
startActivity(intent);
} else {
Toast.makeText(getBaseContext(), "Proceso Incorrecto ", Toast.LENGTH_LONG).show();
Toast.makeText(Home.this, httpResponseMsg, Toast.LENGTH_LONG).show();
}
}
protected String doInBackground(String... params) {
hashMap.put("iddispositivo", params[0]);
hashMap.put("iduser", params[1]);
hashMap.put("ubicacion", params[2]);
finalResult = httpParse.postRequest(hashMap, updatee);
return finalResult;
}
}
UpDni UPD = new UpDni();
UPD.execute(iddispositivo, iduser, uubicacion);
}
It turns out that always in the if it throws me incorrect process and then shows the "correct" message that if it is adequately replenishing the server, at first I thought it was a server problem and decided to try it in the following way in the .php
if($_SERVER['REQUEST_METHOD']=='POST'){
////////////////si no se cumple if (($calendarioid != '') && ($usubloq == '0'))
$incidenciaid = $_POST['iddispositivo
']
$usuarioid = $_POST['iduser'];
$ubicacion = $_POST['ubicacion'];
echo "correcto";
}
In theory, it should always show me a successful process, but it shows me an incorrect process and prints "correct", that is, if it is receiving properly.