You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Joe Bowser <bo...@gmail.com> on 2016/02/17 01:41:53 UTC

[Android] CB-10625 Google Photos update breaks Camera's Gallery API

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?

Re: [Android] CB-10625 Google Photos update breaks Camera's Gallery API

Posted by julio cesar sanchez <jc...@gmail.com>.
I've commited new changes that should fix the whole problem. When you edit
the image it get changed and then you get it from a file path instead of a
content path.

2016-02-21 23:22 GMT+01:00 julio cesar sanchez <jc...@gmail.com>:

> The PR doesn't fix CB-10625
> With the fix, if I choose photos app it doesn't takes me to the "edit"
> screen and it works. If I choose gallery app it takes me to the "edit"
> screen and it fails. I can choose 2 apps to edit, photos and crop app, none
> of them work.
>
> 2016-02-21 21:09 GMT+01:00 julio cesar sanchez <jc...@gmail.com>:
>
>> 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 <jc...@gmail.com>:
>>
>>> 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 <jc...@gmail.com>:
>>>
>>>> Sure, I can send it this weekend.
>>>>
>>>> 2016-02-18 18:49 GMT+01:00 Joe Bowser <bo...@gmail.com>:
>>>>
>>>>> 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 <
>>>>> jcesarmobile@gmail.com
>>>>> > 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 <bo...@gmail.com>:
>>>>> >
>>>>> > > 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?
>>>>> > >
>>>>> >
>>>>>
>>>>
>>>>
>>>
>>
>

Re: [Android] CB-10625 Google Photos update breaks Camera's Gallery API

Posted by julio cesar sanchez <jc...@gmail.com>.
The PR doesn't fix CB-10625
With the fix, if I choose photos app it doesn't takes me to the "edit"
screen and it works. If I choose gallery app it takes me to the "edit"
screen and it fails. I can choose 2 apps to edit, photos and crop app, none
of them work.

2016-02-21 21:09 GMT+01:00 julio cesar sanchez <jc...@gmail.com>:

> 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 <jc...@gmail.com>:
>
>> 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 <jc...@gmail.com>:
>>
>>> Sure, I can send it this weekend.
>>>
>>> 2016-02-18 18:49 GMT+01:00 Joe Bowser <bo...@gmail.com>:
>>>
>>>> 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 <
>>>> jcesarmobile@gmail.com
>>>> > 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 <bo...@gmail.com>:
>>>> >
>>>> > > 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?
>>>> > >
>>>> >
>>>>
>>>
>>>
>>
>

Re: [Android] CB-10625 Google Photos update breaks Camera's Gallery API

Posted by julio cesar sanchez <jc...@gmail.com>.
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 <jc...@gmail.com>:

> 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 <jc...@gmail.com>:
>
>> Sure, I can send it this weekend.
>>
>> 2016-02-18 18:49 GMT+01:00 Joe Bowser <bo...@gmail.com>:
>>
>>> 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 <
>>> jcesarmobile@gmail.com
>>> > 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 <bo...@gmail.com>:
>>> >
>>> > > 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?
>>> > >
>>> >
>>>
>>
>>
>

Re: [Android] CB-10625 Google Photos update breaks Camera's Gallery API

Posted by julio cesar sanchez <jc...@gmail.com>.
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 <jc...@gmail.com>:

> Sure, I can send it this weekend.
>
> 2016-02-18 18:49 GMT+01:00 Joe Bowser <bo...@gmail.com>:
>
>> 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 <
>> jcesarmobile@gmail.com
>> > 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 <bo...@gmail.com>:
>> >
>> > > 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?
>> > >
>> >
>>
>
>

Re: [Android] CB-10625 Google Photos update breaks Camera's Gallery API

Posted by julio cesar sanchez <jc...@gmail.com>.
Sure, I can send it this weekend.

2016-02-18 18:49 GMT+01:00 Joe Bowser <bo...@gmail.com>:

> 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 <
> jcesarmobile@gmail.com
> > 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 <bo...@gmail.com>:
> >
> > > 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?
> > >
> >
>

Re: [Android] CB-10625 Google Photos update breaks Camera's Gallery API

Posted by Joe Bowser <bo...@gmail.com>.
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 <jcesarmobile@gmail.com
> 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 <bo...@gmail.com>:
>
> > 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?
> >
>

Re: [Android] CB-10625 Google Photos update breaks Camera's Gallery API

Posted by julio cesar sanchez <jc...@gmail.com>.
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 <bo...@gmail.com>:

> 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?
>