@Override
  protected Boolean doInBackground(String... args) {

    Log.d(MainActivity.TAG, "doInBackground " + args[0] + " " + args[1]);
    String inputFile = args[0];
    String outputFile = args[1];

    try {
      Client restClient = new Client();

      //			!!! Please provide application id and password and remove this line. !!!
      // To create an application and obtain a password,
      // register at http://cloud.ocrsdk.com/Account/Register
      // More info on getting your application id and password at
      // http://ocrsdk.com/documentation/faq/#faq3

      // Name of application you created
      restClient.applicationId = Setting.getInstance().abbyy_applicationId.trim();
      // You should get e-mail from ABBYY Cloud OCR SDK service with the application password
      restClient.password = Setting.getInstance().abbyy_password.trim();

      // Obtain installation id when running the application for the first time
      SharedPreferences settings = activity.getPreferences(Activity.MODE_PRIVATE);
      String instIdName = "installationId";
      if (!settings.contains(instIdName)) {
        // Get installation id from server using device id
        String deviceId =
            android.provider.Settings.Secure.getString(
                activity.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);

        // Obtain installation id from server
        publishProgress("First run: obtaining installation id..");
        String installationId = restClient.activateNewInstallation(deviceId);
        publishProgress("Done. Installation id is '" + installationId + "'");

        SharedPreferences.Editor editor = settings.edit();
        editor.putString(instIdName, installationId);
        editor.commit();
      }

      String installationId = settings.getString(instIdName, "");
      restClient.applicationId += installationId;

      publishProgress("Uploading image...");

      String language =
          mLanguage; // Comma-separated list: Japanese,English or German,French,Spanish etc.

      ProcessingSettings processingSettings = new ProcessingSettings();
      processingSettings.setOutputFormat(ProcessingSettings.OutputFormat.txt);
      processingSettings.setLanguage(language);

      publishProgress("Uploading..");

      // If you want to process business cards, uncomment this
      /*
      BusCardSettings busCardSettings = new BusCardSettings();
      busCardSettings.setLanguage(language);
      busCardSettings.setOutputFormat(BusCardSettings.OutputFormat.xml);
      Task task = restClient.processBusinessCard(filePath, busCardSettings);
      */
      Task task = restClient.processImage(inputFile, processingSettings);

      while (task.isTaskActive()) {
        // Note: it's recommended that your application waits
        // at least 2 seconds before making the first getTaskStatus request
        // and also between such requests for the same task.
        // Making requests more often will not improve your application performance.
        // Note: if your application queues several files and waits for them
        // it's recommended that you use listFinishedTasks instead (which is described
        // at http://ocrsdk.com/documentation/apireference/listFinishedTasks/).

        Thread.sleep(5000);
        publishProgress("Waiting..");
        task = restClient.getTaskStatus(task.Id);
      }

      if (task.Status == Task.TaskStatus.Completed) {
        publishProgress("Downloading..");
        FileOutputStream fos = new FileOutputStream(outputFile);
        //				FileOutputStream fos = activity.openFileOutput(outputFile,Context.MODE_PRIVATE);

        try {
          restClient.downloadResult(task, fos);
        } finally {
          fos.close();
        }

        publishProgress("Ready");
      } else if (task.Status == Task.TaskStatus.NotEnoughCredits) {
        throw new Exception(
            "Not enough credits to process task. Add more pages to your application's account.");
      } else {
        throw new Exception("Task failed");
      }

      return true;
    } catch (Exception e) {
      final String message = "Error: " + e.getMessage();
      publishProgress(message);
      //			activity.displayMessage(message);
      return false;
    }
  }