cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James White (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-6944) Media-Capture plugin on Android returns Canceled error when Accept image is selected
Date Mon, 16 Jun 2014 21:04:02 GMT

    [ https://issues.apache.org/jira/browse/CB-6944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14032945#comment-14032945
] 

James White commented on CB-6944:
---------------------------------

It seems that the issue is with the directory the image capture intent is being given.

In the below function: (Capture.java, lines 208-217)
private String getTempDirectoryPath() {
        File cache = null;

        // Use internal storage
        cache = cordova.getActivity().getCacheDir();

        // Create the cache directory if it doesn't exist
        cache.mkdirs();
        return cache.getAbsolutePath();
    }

whenever cache is being assigned an application-specific internal path, the camera app either
prevents the user from being able to select the accept image checkmark, or returns error code
3/Canceled.  
Changing cache to be of a path outside of an internal application directory seems to resolve
both of the issues for some reason.

Examples of what worked:
cache = cordova.getActivity().getExternalCacheDir();
cache = cordova.getActivity().getExternalFilesDir(null);
cache = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);

A posting on stackoverflow (http://stackoverflow.com/questions/1910608/android-action-image-capture-intent)
refers to there being some kind of known bug with the image capture intent, where one user's
workaround looks like it refers to external storage.

> Media-Capture plugin on Android returns Canceled error when Accept image is selected
> ------------------------------------------------------------------------------------
>
>                 Key: CB-6944
>                 URL: https://issues.apache.org/jira/browse/CB-6944
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Media Capture
>    Affects Versions: 3.5.0
>         Environment: Android 4.0.x, 4.1, 4.2, 4.3, 4.4
> Cordova 3.5.0-0.2.4
> Plugins:
> org.apache.cordova.file 1.2.0 "File"
> org.apache.cordova.media-capture 0.3.1 "Capture"
>            Reporter: James White
>            Priority: Critical
>         Attachments: index.js
>
>
> Attempting to run the following:
> {noformat}
> navigator.device.capture.captureImage(function(mediaFiles) { alert('success?');  },
> function(error)
> {
>   navigator.notification.alert('Error code: ' + error.code + ' = ' + error.message, null,
'Capture Error');
>  },{ limit:1 });
> {noformat}
> always invokes the error callback with the object:
> {noformat}
> {"message":"Canceled.", "code":3}
> {noformat}
> even if the accept image option is selected.
> Android 4.4 behaves differently, where tapping on the accept image option does nothing
and instead of returning with the error, it remains on the captured photo view.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message