[TIMOB-25265] Android: OpenPhotoGallery crash when i try to select images with small cloud icon(not backup)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-08-30T02:44:04.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | boaz@e-drivetech.com |
Assignee | Unknown |
Created | 2017-09-11T13:44:44.000+0000 |
Updated | 2018-08-30T02:44:04.000+0000 |
Description
app freezes and crashes without errors when using openPhotoGallery and selecting images with small cloud icon.
Those images are part of the device storage and not yet back up.
When pressing on images with no backup cloud icon it works well and i get to the success callback event
6.1.2.GA
Below used function.
var buttonGallery = Titanium.UI.createButton({
title:"Open the photo gallery",
width:180,
height:48,
bottom: 12,
zIndex:2
});
buttonGallery.addEventListener("click", function(e){
//obtain an image from the gallery
Titanium.Media.openPhotoGallery({
success:function(event)
{
alert('1');
},
error:function(error)
{
//set message
if (error.code == Titanium.Media.NO_CAMERA)
{
alert('No Cam');
}
else
{
alert('error');
}
},
cancel:function()
{
//user cancelled the action fron within
//the photo gallery
}
});
});
Hey there, is this iOS or Android? Please always indicate the platform and complete environment (CLI-version, SDK-version, platform, platform version). Also, any idea how to test this? Connect with iCloud and try to access it before it's synced? I feel, if it's an iOS issue, it's rather an edge-case on iOS that is not handled properly, since it shouldn't even show up in the media-picker then.
Android Samsung 7 edge Latest cli and sdk 6.2.2
[~boaz@e-drivetech.com], can you tell us which photo gallery app was opened please? That is, did it look like Google's standard gallery app? Or a custom one from Samsung? Or did you do a photo selection from another app such as GoogleDrive, DropBox, OneDrive, etc.? (I ask because photo selection can default to 3rd party apps.) Also, if you can provide us the logged Android error messages, then that might help us isolate the issue. Thanks!
We are experiencing this issue as well: Android 7.0 SDK: 7.0.2.GA When we call Ti.Media.openPhotoGallery, it opens up the Gallery of "Recent" photos and auto-slides out the menu drawer to let us select between "Downloads", "Phone", "Google Drive", "Dropbox", etc... When we select the "Dropbox" option, it opens dropbox, we select the desired file, and dropbox displays a "downloading" ux. Shortly after downloading (presumably when resuming our app with the selected image result) we get the following crash w/ stack trace:
More Info: I tried an alternative approach as a possible workaround but also ran into a similiar issue. The general idea for this workaround was to: 1) Launch an intent directly with the ACTION_GET_CONTENT action to pick an image (ultimately from dropbox) 2) Upon success, we get a uri from dropbox contained in e.intent.data like: content://com.dropbox.android.FileCache/filecache/441c518d-c217-466b-8f6c-541d1b831f9a (this file had just been selected in dropbox ux and downloaded to device) 3) Copy the content to a file in our app temp directory using Ti.Filesystem.getFile and copy() to effectively resolve the content uri and make a copy for us in our temp folder that we can access normally to get the image CODE:
However we encountered a similiar exception when we called
Here is the exception: {noformat} [ERROR] CursorWindow: Failed to read row 0, column 1 from a CursorWindow which has 1 rows, 1 columns. [WARN] W/System.err: java.lang.IllegalStateException: Couldn't read row 0, col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. [WARN] W/System.err: at android.database.CursorWindow.nativeGetString(Native Method) [WARN] W/System.err: at android.database.CursorWindow.getString(CursorWindow.java:460) [WARN] W/System.err: at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51) [WARN] W/System.err: at android.database.CursorWrapper.getString(CursorWrapper.java:142) [WARN] W/System.err: at org.appcelerator.titanium.io.TitaniumBlob.init(TitaniumBlob.java:86) [WARN] W/System.err: at org.appcelerator.titanium.io.TitaniumBlob.
Everyone, the cloud photo selection issues are fixed in Titanium 7.3.0. When we added support for video selection in [TIMOB-24707], we ended up resolving the "content://" URL scheme issues we had.