private void dispatchTakePictureIntent() {
    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    // Ensure that there's a camera activity to handle the intent
    if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
      photoFile = null;
      try {
        photoFile = createImageFile();
      } catch (IOException ex) {
        Log.e(LOG, "F**k!", ex);
        Util.showErrorToast(ctx, getString(R.string.file_error));
        return;
      }
      if (photoFile != null) {
        Log.w(LOG, "dispatchTakePictureIntent - start pic intent");

        if (mLocationClient.isConnected()) {
          Log.w(LOG, "## requesting mLocationClient updates before picture taken");
          mLocationClient.requestLocationUpdates(mLocationRequest, this);
        } else {
          mLocationClient.connect();
        }
        takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
        startActivityForResult(takePictureIntent, CAPTURE_IMAGE);
      }
    }
  }
 @Override
 protected void onPostExecute(Integer result) {
   if (result > 0) {
     Util.showErrorToast(ctx, ctx.getResources().getString(R.string.camera_error));
     return;
   }
   if (thumbUri != null) {
     pictureChanged = true;
     try {
       image.setImageBitmap(bitmapForScreen);
       uploadPhotos();
       //                    if (bitmapForScreen.getWidth() > bitmapForScreen.getHeight()) {
       //
       // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
       //                    } else {
       //
       // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
       //                    }
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }