You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Simon MacDonald (JIRA)" <ji...@apache.org> on 2012/08/29 17:12:08 UTC

[jira] [Commented] (CB-1293) Camera.getPicture crashes when selecting from a Picasa album on Android

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

Simon MacDonald commented on CB-1293:
-------------------------------------

I enabled Picasa Web Album Sync on my phone and retrieved a picture using the following code:

navigator.camera.getPicture(
    function(data) {
        var img = document.getElementById('camera_image');
        img.style.visibility = "visible";
        img.style.display = "block";
        img.src = data;
        document.getElementById('camera_status').innerHTML = "Success";
        console.log("The URL is = " + data);
    },
    function(e) {
        console.log("Error getting picture: " + e);
        document.getElementById('camera_status').innerHTML = "Error getting picture.";
    },
    { quality: 50, destinationType: Camera.DestinationType.FILE_URI, sourceType: Camera.PictureSourceType.PHOTOLIBRARY});

I'm able to get the picture without any crashes and it displays in my app correctly. The content URI that I get looks like: 

    content://media/external/images/media/82

Please provide more details so that I may reproduce the issue.
                
> Camera.getPicture crashes when selecting from a Picasa album on Android
> -----------------------------------------------------------------------
>
>                 Key: CB-1293
>                 URL: https://issues.apache.org/jira/browse/CB-1293
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.0.0
>         Environment: Crash found with 2.0.0 on Galaxy Nexus running Android 4.0.4
>            Reporter: Brion Vibber
>            Assignee: Simon MacDonald
>
> When using camera.getPicture with options:
>   destinationType: Camera.DestinationType.FILE_URI,
>   sourceType: Camera.PictureSourceType.PHOTOLIBRARY
> and selecting a photo from a Picasa-synced album, the application crashes immediately upon trying to return the data.
> Here's our downstream bug with some analysis: https://bugzilla.wikimedia.org/show_bug.cgi?id=39604
> FileUtils.getRealPathFromURI() cannot read the "_data" column from the content provider database, so imagePath and bitmap in CameraLauncher.onActivityResult are null. The crash occurs when trying to run bitmap.recycle().
> I can avoid the crash by adding a guard check for bitmap != null and the content: URI is usable in the app to load the image, but doesn't appear to work with FileTransfer.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira