Phonegap / Cordova Capture图像可能无需通知确认?

时间:2014-07-01 14:57:10

标签: android cordova

我目前正在使用navigator.device.capture.captureImage

是否有可能以某种方式实现此目的,以便在每次捕获图片后不会弹出确认对话框?因为需要一张照片,调出确认对话框,暂时返回应用程序一秒钟,然后重新启动相机。

理想情况下,我希望能够像原生相机应用程序一样拍摄多张照片,然后退出相机并处理captureSuccess回调。

我在plugins git page上找到了以下内容:如果我能找到另一种错误检查方法,是否就像删除if子句if (resultCode == Activity.RESULT_OK)一样简单?

 private void captureImage() {
    // Save the number of images currently on disk for later
    this.numPics = queryImgDB(whichContentStore()).getCount();

    Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

    // Specify file so that large image is captured and returned
    File photo = new File(getTempDirectoryPath(), "Capture.jpg");
    try {
        // the ACTION_IMAGE_CAPTURE is run under different credentials and has to be granted write permissions 
        createWritableFile(photo);
    } catch (IOException ex) {
        this.fail(createErrorObject(CAPTURE_INTERNAL_ERR, ex.toString()));
        return;
    }
    intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));

    this.cordova.startActivityForResult((CordovaPlugin) this, intent, CAPTURE_IMAGE);
}


public void onActivityResult(int requestCode, int resultCode, final Intent intent) {

    // Result received okay
    if (resultCode == Activity.RESULT_OK) {
        etc

提前致谢

0 个答案:

没有答案