You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "David Wedgbury (JIRA)" <ji...@apache.org> on 2014/01/17 13:02:21 UTC

[jira] [Commented] (CB-5133) saveToPhotoAlbum throws exception on android

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

David Wedgbury commented on CB-5133:
------------------------------------

I have a HTC One V that has both internal storage and an SD Card slot so external storage is possible but not mandatory. 

This error occurs when an SD Card is not inserted (which is perfectly legal). The camera actually saves the photos to its internal storage (they show in the gallery when I check), but my app bombs out "Unfortunately, <App> has stopped".

On resetting the HTC camera app, it informs me that an SD Card is not available so it has switched to internal storage, so the camera app is fully aware of the destination of photos that it saves. 

This may be a rare scenario, but Cordova really ought to handle it better. 

FYI: 

01-17 11:51:39.934: E/JHEAD(16323): can't open '/data/data/xxx.xxx.xxx/cache/.Pic.jpg' appears in my logcat just before the exception in this issue's description

I'm using Cordova 2.4.

> saveToPhotoAlbum throws exception on android
> --------------------------------------------
>
>                 Key: CB-5133
>                 URL: https://issues.apache.org/jira/browse/CB-5133
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 3.1.0
>         Environment: android 2.3.7
>            Reporter: Petr Šimon
>            Assignee: Joe Bowser
>
> trying:
> {code}
> navigator.camera.getPicture( onCameraSuccess, onCameraError, {saveToPhotoAlbum: true });
> {code}
> {code}
> 10-20 16:21:07.778: E/(19552): can't open 'file:///mnt/sdcard/DCIM/Camera/1382257264583.jpg'
> 10-20 16:21:07.898: E/MediaScannerService(19552): Exception in handleMessage
> 10-20 16:21:07.898: E/MediaScannerService(19552): java.lang.IllegalStateException: Unable to create new file: file:///mnt/sdcard/DCIM/Camera/1382257264583.jpg
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at com.android.providers.media.MediaProvider.ensureFile(MediaProvider.java:1880)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:1990)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at com.android.providers.media.MediaProvider.insert(MediaProvider.java:1921)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at android.content.ContentProvider$Transport.insert(ContentProvider.java:198)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at android.media.MediaScanner$MyMediaScannerClient.endFile(MediaScanner.java:787)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at android.media.MediaScanner$MyMediaScannerClient.doScanFile(MediaScanner.java:525)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at android.media.MediaScanner.scanSingleFile(MediaScanner.java:1236)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at com.android.providers.media.MediaScannerService.scanFile(MediaScannerService.java:200)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at com.android.providers.media.MediaScannerService.access$100(MediaScannerService.java:48)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at com.android.providers.media.MediaScannerService$ServiceHandler.handleMessage(MediaScannerService.java:244)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at android.os.Handler.dispatchMessage(Handler.java:99)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at android.os.Looper.loop(Looper.java:130)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at com.android.providers.media.MediaScannerService.run(MediaScannerService.java:188)
> 10-20 16:21:07.898: E/MediaScannerService(19552): 	at java.lang.Thread.run(Thread.java:1019)
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)