Joe, I've found the real problem, forget what I said about the
isGooglePhotosUri, it wasn't even entering in the if, it was crashing on
DocumentsContract.getDocumentId(uri); with "IllegalArgumentException:
Invalid URI"

I've added a try catch and in case it crashes it will use the original uri
to query the content resolver.

Take a look to the PR and let me know what do you think.

https://github.com/apache/cordova-plugin-camera/pull/175

2016-02-21 0:20 GMT+01:00 julio cesar sanchez <[email protected]>:

> Bad news, I tried at home and didn't work on android 4.4 or android 5,
> it's not entering on the isGooglePhotosUri and always goes to the error
> callback. Trying to force the uri.getLastPathSegment() doesn't return a
> good url neither.
> I'm not sure why it worked when I tested on android M, will check again on
> monday.
>
>
>
>
> 2016-02-19 8:22 GMT+01:00 julio cesar sanchez <[email protected]>:
>
>> Sure, I can send it this weekend.
>>
>> 2016-02-18 18:49 GMT+01:00 Joe Bowser <[email protected]>:
>>
>>> Cool, want to send a PR so we can get this resolved? I tried string
>>> manipulation, but for some reason it didn't work.
>>>
>>> On Thu, Feb 18, 2016 at 1:22 AM, julio cesar sanchez <
>>> [email protected]
>>> > wrote:
>>>
>>> > I already answered on CB-10625
>>> >
>>> > When android 4.4 broke input type file support I wrote a plugin at
>>> work to
>>> > use a file picker instead.
>>> >
>>> > For google Photos I use this code:
>>> >
>>> > if (isGooglePhotosUri(uri))
>>> >                 return uri.getLastPathSegment();
>>> >
>>> > Where isGooglePhotosUri is
>>> >
>>> > public static boolean isGooglePhotosUri(Uri uri) {
>>> >     return
>>> > "com.google.android.apps.photos.content".equals(uri.getAuthority());
>>> > }
>>> >
>>> > I tried it on the camera plugin and worked.
>>> >
>>> >
>>> > The plugin is based on this android library
>>> > https://github.com/iPaulPro/aFileChooser
>>> >
>>> > The relevant class is
>>> >
>>> >
>>> https://github.com/iPaulPro/aFileChooser/blob/master/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java
>>> >
>>> >
>>> >
>>> >
>>> > 2016-02-17 1:41 GMT+01:00 Joe Bowser <[email protected]>:
>>> >
>>> > > Hey
>>> > >
>>> > > https://issues.apache.org/jira/browse/CB-10625
>>> > >
>>> > > For some reason Google Photos breaks the Camera's Gallery API, and
>>> I'm
>>> > > having trouble trying to fix this one.  For some reason I can't get
>>> the
>>> > > FileHelper to work with the new file URI that's being provided by an
>>> > > application.  Is there something obvious that we're missing here?
>>> > >
>>> > > Any thoughts?
>>> > >
>>> >
>>>
>>
>>
>

Reply via email to