cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Billau <mike.bil...@gmail.com>
Subject Re: input type=file broken on Android 4.4
Date Wed, 05 Feb 2014 17:48:09 GMT
Resurrecting this thread. The problem is that input type="file" does not
show a file picker dialog; this is a problem with Chromium on Android and
you can see that even the Chrome browser can't handle this either.

I think we should just document this as an Android Quirk and wait for it to
be fixed in the WebView because:
1. We don't want to build a file picker UI and have to maintain that
2. The bug seems fixed in Chrome Beta so hopefully the fix will make it
into the WebView soon
3. There are probably a few different ways people can handle this with
File/FileTransfer and the solution might be different for everyone

One secondary issue is: Where to add this documentation? There isn't an
overall "Android Platform Quirks" section, so we could either add this as
an additional guide under Android, or add it in the Android Upgrade Guide
[1], or just a blog post. Personally I think adding a new guide is too much
overhead and would perfer to stick the notice in the Upgrade Guide by the
first version of Cordova that supported 4.4. If nobody has any objections,
I'll add a quirk note to the Upgrading Guide, section "Updating to 3.2 from
3.1"

Here is the text I want to use:
"Starting on Android 4.4, creating a file input element with type="file"
will not open the file picker dialog.
This is a regression with Chromium on Android and the problem can be
reproduced in the standalone Chrome browser on Android (see
http://code.google.com/p/android/issues/detail?id=62220)  The suggested
workaround is to use the FileTransfer and File plugins for Android 4.4. You
can listen for an onClick event from the input type="file" and then pop up
a file picker UI. In order to tie the form data with the upload, you can
use JavaScript to attach form values to the multi-part POST request that
FileTransfer makes."


[1]
http://cordova.apache.org/docs/en/edge/guide_platforms_android_upgrading.md.html#Upgrading%20Android






On Fri, Nov 15, 2013 at 11:34 PM, James Jong <wjamesjong@gmail.com> wrote:

> Ugh... hopefully there's a better solution.
> -James Jong
>
> On Nov 14, 2013, at 2:10 PM, Brian LeRoux <b@brian.io> wrote:
>
> > Ugly indeed but that is what we do! =)
> >
> > Probably just a docs issue doing what you describe.
> >
> >
> > On Thu, Nov 14, 2013 at 10:57 AM, Andrew Grieve <agrieve@chromium.org
> >wrote:
> >
> >> I'll ask around and see if anyone has ideas on fixing it.
> >>
> >> We could probably polyfill it though, by having a click handler on the
> body
> >> looking for clicks on <input type=file>, and then hijacking the
> onsubmit()
> >> of the form. Ugly.
> >>
> >>
> >> On Thu, Nov 14, 2013 at 12:09 PM, Brian LeRoux <b@brian.io> wrote:
> >>
> >>> I think it is reasonable that we choose to allow a polyfill for this
> >>> regardless of the Google stance. The change is very likely to break
> >>> existing users and just b/c it was 'private' doesn't mean that it
> wasn't
> >>> exposed. Maybe this is just a docs issue given we have the scaffolding
> to
> >>> fix this with File/FileTransfer.
> >>>
> >>> ??
> >>>
> >>>
> >>> On Thu, Nov 14, 2013 at 8:39 AM, Joe Bowser <bowserj@gmail.com> wrote:
> >>>
> >>>> Apologize and say "Sorry, the Android team hates Cordova"?
> >>>>
> >>>> Honestly, was this a private API that was in the Android Browser code?
> >>>> If so, then we should assume that this would break, since this wasn't
> >>>> referenced in the Android APIs.  This is outside our scope, and we
> >>>> really can't do anything more with this without even more breakage.
> >>>>
> >>>> On Thu, Nov 14, 2013 at 8:26 AM, Mike Billau <mike.billau@gmail.com>
> >>>> wrote:
> >>>>> Hi everyone,
> >>>>>
> >>>>> This ticket[1] came in pretty recently talking about how input
> >>> type=file
> >>>>> does not work with Android 4.4 anymore, regardless of what your
> >> target
> >>>> SDK
> >>>>> is.
> >>>>>
> >>>>> Apparently this was a conscious design decision by Android [2].
> >>>>>
> >>>>> Does anybody have ideas on how we can fix this? Is this even in
our
> >>>> scope?
> >>>>> From what I can gather, we have always had to override certain
> >> 'hidden'
> >>>>> (yet public) methods on CordovaChromeClient [3] to enable input
> >>>> type=file.
> >>>>> I'm thinking that either Android made this a private method or they
> >>> just
> >>>>> changed the method signature again. If they just changed the method
> >>>>> signature, hopefully the new one will surface pretty soon and we
can
> >>>> adjust
> >>>>> CordovaChromeClient (I tried looking around in Android source but
got
> >>>>> pretty lost pretty quick...)
> >>>>>
> >>>>> Just wanted to get some more opinions on what we should do. This
> >> seems
> >>>> like
> >>>>> it could be a pretty breaking change for some of our users.
> >>>>>
> >>>>>
> >>>>> [1] https://issues.apache.org/jira/browse/CB-5294
> >>>>> [2] http://code.google.com/p/android/issues/detail?id=62220
> >>>>> [3]
> >>>>>
> >>>>
> >>>
> >>
> https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaChromeClient.java#L367
> >>>>
> >>>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message