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 2014/06/05 23:33:52 UTC

[Android] 4.0.x plugin fixes

Hey

So, since we're wanting to introduce new APIs, such as
getPluginManager() and getPlugin() on the WebView itself, we're going
to need to update our plugins.  I did some work on this today, but I
need to know where these changes should live, since I don't think they
belong in master until 4.0.x on Android is released.

So, What should we do with this?  Any ideas?

Joe

Re: [Android] 4.0.x plugin fixes

Posted by Marcel Kinard <cm...@gmail.com>.
Yes, 3.5 is out. http://cordova.apache.org/announcements/2014/05/23/cordova-350.html

On Jun 6, 2014, at 12:40 PM, Joe Bowser <bo...@gmail.com> wrote:

> Can't we ease in the methods and deprecate in 3.6???
> 
> BTW: Is 3.5 out yet? I voted on the thread for the Android platform.


Re: [Android] 4.0.x plugin fixes

Posted by Joe Bowser <bo...@gmail.com>.
Can't we ease in the methods and deprecate in 3.6???

BTW: Is 3.5 out yet? I voted on the thread for the Android platform.

On Fri, Jun 6, 2014 at 9:09 AM, Andrew Grieve <ag...@chromium.org> wrote:
> I like the reflection idea since that will let us avoid branching & make
> the plugins work with both 3.x and 4.x. Others will hit the same problem,
> but likely others will want a way to target both versions as the solution.
>
>
> On Fri, Jun 6, 2014 at 10:51 AM, Ian Clelland <ic...@chromium.org>
> wrote:
>
>> This has been bugging me for a bit now. We definitely need a branch for
>> development on the plugins. (FTR, there's a pluggable_webview branch on
>> file, file-transfer and media-capture already, with this particular fix. We
>> can rename that)
>>
>> We're going to have trouble releasing these plugins when we release
>> cordova-android 4.0.0 -- I don't think that the tools right now will
>> support having two installable versions of a plugin, distinguished only by
>> one of the <platform> version requirements. That's a deficiency that we
>> need to fix before 4.0.
>>
>> Alternately, we use reflection in our core plugins to see whether the
>> WebView class has these methods, and support both 3.x and 4.x with the same
>> code. That's a pretty ugly solution, though, and doesn't help anyone else
>> in the same situation.
>>
>>
>> On Fri, Jun 6, 2014 at 9:56 AM, Marcel Kinard <cm...@gmail.com> wrote:
>>
>> > That is my first thought as well. Perhaps name the plugin branch
>> something
>> > like “android-4.0”?
>> >
>> > On Jun 5, 2014, at 5:38 PM, Steven Gill <st...@gmail.com> wrote:
>> >
>> > > 4.0 branch for the plugins?
>> > >
>> > >
>> > > On Thu, Jun 5, 2014 at 2:33 PM, Joe Bowser <bo...@gmail.com> wrote:
>> > >
>> > >> Hey
>> > >>
>> > >> So, since we're wanting to introduce new APIs, such as
>> > >> getPluginManager() and getPlugin() on the WebView itself, we're going
>> > >> to need to update our plugins.  I did some work on this today, but I
>> > >> need to know where these changes should live, since I don't think they
>> > >> belong in master until 4.0.x on Android is released.
>> > >>
>> > >> So, What should we do with this?  Any ideas?
>> > >>
>> > >> Joe
>> > >>
>> >
>> >
>>

Re: [Android] 4.0.x plugin fixes

Posted by Ian Clelland <ic...@chromium.org>.
This is the code that I'd be using to get, for instance, the File plugin
from the FileTransfer plugin:

    Class webViewClass = webView.getClass();
    PluginManager pm;
    try {
        Method gpm = webViewClass.getMethod("getPluginManager");
        pm = (PluginManager) gpm.invoke(webView);
    } catch (NoSuchMethodException e) {
        Field pmf = webViewClass.getField("pluginManager");
        pm = (PluginManager)pmf.get(webView);
    }
    FileUtils filePlugin = (FileUtils) pm.getPlugin("File");


This would replace both the old-style field access:

    FileUtils filePlugin =
(FileUtils)(webView.pluginManager.getPlugin("File"));

and the new-style getter:

    FileUtils filePlugin =
(FileUtils)(webView.getPluginManager().getPlugin("File"));
It's not so bad, maybe. We would have to include it in three or four places
in our plugins, and then they would work with both 3.x and 4.x branches.
Other devs could follow suit, or just publish different versions, or just
develop for 4.x and above :)

Ian

On Fri, Jun 6, 2014 at 12:09 PM, Andrew Grieve <ag...@chromium.org> wrote:

> I like the reflection idea since that will let us avoid branching & make
> the plugins work with both 3.x and 4.x. Others will hit the same problem,
> but likely others will want a way to target both versions as the solution.
>
>
> On Fri, Jun 6, 2014 at 10:51 AM, Ian Clelland <ic...@chromium.org>
> wrote:
>
> > This has been bugging me for a bit now. We definitely need a branch for
> > development on the plugins. (FTR, there's a pluggable_webview branch on
> > file, file-transfer and media-capture already, with this particular fix.
> We
> > can rename that)
> >
> > We're going to have trouble releasing these plugins when we release
> > cordova-android 4.0.0 -- I don't think that the tools right now will
> > support having two installable versions of a plugin, distinguished only
> by
> > one of the <platform> version requirements. That's a deficiency that we
> > need to fix before 4.0.
> >
> > Alternately, we use reflection in our core plugins to see whether the
> > WebView class has these methods, and support both 3.x and 4.x with the
> same
> > code. That's a pretty ugly solution, though, and doesn't help anyone else
> > in the same situation.
> >
> >
> > On Fri, Jun 6, 2014 at 9:56 AM, Marcel Kinard <cm...@gmail.com>
> wrote:
> >
> > > That is my first thought as well. Perhaps name the plugin branch
> > something
> > > like “android-4.0”?
> > >
> > > On Jun 5, 2014, at 5:38 PM, Steven Gill <st...@gmail.com>
> wrote:
> > >
> > > > 4.0 branch for the plugins?
> > > >
> > > >
> > > > On Thu, Jun 5, 2014 at 2:33 PM, Joe Bowser <bo...@gmail.com>
> wrote:
> > > >
> > > >> Hey
> > > >>
> > > >> So, since we're wanting to introduce new APIs, such as
> > > >> getPluginManager() and getPlugin() on the WebView itself, we're
> going
> > > >> to need to update our plugins.  I did some work on this today, but I
> > > >> need to know where these changes should live, since I don't think
> they
> > > >> belong in master until 4.0.x on Android is released.
> > > >>
> > > >> So, What should we do with this?  Any ideas?
> > > >>
> > > >> Joe
> > > >>
> > >
> > >
> >
>

Re: [Android] 4.0.x plugin fixes

Posted by Andrew Grieve <ag...@chromium.org>.
I like the reflection idea since that will let us avoid branching & make
the plugins work with both 3.x and 4.x. Others will hit the same problem,
but likely others will want a way to target both versions as the solution.


On Fri, Jun 6, 2014 at 10:51 AM, Ian Clelland <ic...@chromium.org>
wrote:

> This has been bugging me for a bit now. We definitely need a branch for
> development on the plugins. (FTR, there's a pluggable_webview branch on
> file, file-transfer and media-capture already, with this particular fix. We
> can rename that)
>
> We're going to have trouble releasing these plugins when we release
> cordova-android 4.0.0 -- I don't think that the tools right now will
> support having two installable versions of a plugin, distinguished only by
> one of the <platform> version requirements. That's a deficiency that we
> need to fix before 4.0.
>
> Alternately, we use reflection in our core plugins to see whether the
> WebView class has these methods, and support both 3.x and 4.x with the same
> code. That's a pretty ugly solution, though, and doesn't help anyone else
> in the same situation.
>
>
> On Fri, Jun 6, 2014 at 9:56 AM, Marcel Kinard <cm...@gmail.com> wrote:
>
> > That is my first thought as well. Perhaps name the plugin branch
> something
> > like “android-4.0”?
> >
> > On Jun 5, 2014, at 5:38 PM, Steven Gill <st...@gmail.com> wrote:
> >
> > > 4.0 branch for the plugins?
> > >
> > >
> > > On Thu, Jun 5, 2014 at 2:33 PM, Joe Bowser <bo...@gmail.com> wrote:
> > >
> > >> Hey
> > >>
> > >> So, since we're wanting to introduce new APIs, such as
> > >> getPluginManager() and getPlugin() on the WebView itself, we're going
> > >> to need to update our plugins.  I did some work on this today, but I
> > >> need to know where these changes should live, since I don't think they
> > >> belong in master until 4.0.x on Android is released.
> > >>
> > >> So, What should we do with this?  Any ideas?
> > >>
> > >> Joe
> > >>
> >
> >
>

Re: [Android] 4.0.x plugin fixes

Posted by Ian Clelland <ic...@chromium.org>.
This has been bugging me for a bit now. We definitely need a branch for
development on the plugins. (FTR, there's a pluggable_webview branch on
file, file-transfer and media-capture already, with this particular fix. We
can rename that)

We're going to have trouble releasing these plugins when we release
cordova-android 4.0.0 -- I don't think that the tools right now will
support having two installable versions of a plugin, distinguished only by
one of the <platform> version requirements. That's a deficiency that we
need to fix before 4.0.

Alternately, we use reflection in our core plugins to see whether the
WebView class has these methods, and support both 3.x and 4.x with the same
code. That's a pretty ugly solution, though, and doesn't help anyone else
in the same situation.


On Fri, Jun 6, 2014 at 9:56 AM, Marcel Kinard <cm...@gmail.com> wrote:

> That is my first thought as well. Perhaps name the plugin branch something
> like “android-4.0”?
>
> On Jun 5, 2014, at 5:38 PM, Steven Gill <st...@gmail.com> wrote:
>
> > 4.0 branch for the plugins?
> >
> >
> > On Thu, Jun 5, 2014 at 2:33 PM, Joe Bowser <bo...@gmail.com> wrote:
> >
> >> Hey
> >>
> >> So, since we're wanting to introduce new APIs, such as
> >> getPluginManager() and getPlugin() on the WebView itself, we're going
> >> to need to update our plugins.  I did some work on this today, but I
> >> need to know where these changes should live, since I don't think they
> >> belong in master until 4.0.x on Android is released.
> >>
> >> So, What should we do with this?  Any ideas?
> >>
> >> Joe
> >>
>
>

Re: [Android] 4.0.x plugin fixes

Posted by Marcel Kinard <cm...@gmail.com>.
That is my first thought as well. Perhaps name the plugin branch something like “android-4.0”?

On Jun 5, 2014, at 5:38 PM, Steven Gill <st...@gmail.com> wrote:

> 4.0 branch for the plugins?
> 
> 
> On Thu, Jun 5, 2014 at 2:33 PM, Joe Bowser <bo...@gmail.com> wrote:
> 
>> Hey
>> 
>> So, since we're wanting to introduce new APIs, such as
>> getPluginManager() and getPlugin() on the WebView itself, we're going
>> to need to update our plugins.  I did some work on this today, but I
>> need to know where these changes should live, since I don't think they
>> belong in master until 4.0.x on Android is released.
>> 
>> So, What should we do with this?  Any ideas?
>> 
>> Joe
>> 


Re: [Android] 4.0.x plugin fixes

Posted by Steven Gill <st...@gmail.com>.
4.0 branch for the plugins?


On Thu, Jun 5, 2014 at 2:33 PM, Joe Bowser <bo...@gmail.com> wrote:

> Hey
>
> So, since we're wanting to introduce new APIs, such as
> getPluginManager() and getPlugin() on the WebView itself, we're going
> to need to update our plugins.  I did some work on this today, but I
> need to know where these changes should live, since I don't think they
> belong in master until 4.0.x on Android is released.
>
> So, What should we do with this?  Any ideas?
>
> Joe
>