示例#1
0
    @Override
    protected String doInBackground(String... params) {
      TelephonyManager telephonyManager =
          (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
      String IMEI = telephonyManager.getDeviceId();
      String IMSI = telephonyManager.getSimSerialNumber();
      try {
        String query = SoapRequestMovistar.getButtonBlock(IMEI, IMSI);
        // String query = URLs.BLOQUEO;
        ArrayList<Boton> response = XMLParser.getButtons(query);

        for (Boton b : response) {
          if (b.isActualizacion()) actualizar = b;
          else {
            bloqueo.setBloqueo(b.getId(), b.isEnabled(), b.getName());
          }
          ok = true;
        }
        return "BLOQUEO OK";
      } catch (SAXException e) {
        e.printStackTrace();
        return "Error al leer el xml";
      } catch (ParserConfigurationException e) {
        e.printStackTrace();
        return "Error al leer el xml";
      } catch (XPathExpressionException e) {
        e.printStackTrace();
        return "Error al leer el xml";
      } catch (IOException e) {
        e.printStackTrace();
        return "Se agotó el tiempo de espera con el servidor. Compruebe su conexión a internet y reinicie la aplicación";
      } catch (Exception e) {
        e.printStackTrace();
        return "Error no controlado:\n" + e.getMessage();
      }
    }