You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Smith, Peter" <pe...@fast.au.fujitsu.com> on 2013/07/22 03:05:16 UTC
Embedding Cordova WebView on Android
Hi,
I already asked this on PG Forum but got no replies. For more details
see: https://groups.google.com/forum/#!topic/phonegap/KW0QC4P9P0Y
--
There is a Cordova Guide "Embedding Cordova WebView on Android"
http://cordova.apache.org/docs/en/2.9.0/guide_cordova-webview_android.md
.html#Embedding%20Cordova%20WebView%20on%20Android
Can someone please explain why the guide advises to write the class with
the form:
public class CordovaViewTestActivity extends Activity implements
CordovaInterface {
instead of:
public class CordovaViewTestActivity extends CordovaActivity {
Our problem is that another team in our group has followed this
cut/paste advice but then (since they've failed to maintain their code
to keep up-to-date with changes to CordovaActivity over different
versions) they have come to grief with unexpected behaviours. I thought
if they had just extended from CordovaActivity in the first place they
could have avoided such hassles, but OTOH they thought they were doing
the right thing by following the guide.
--
Apologies if this is the wrong forum to ask this.
Thanks,
Peter
RE: Embedding Cordova WebView on Android
Posted by "Smith, Peter" <pe...@fast.au.fujitsu.com>.
Thankyou for the feedback, but as there were some points made on each
side it's still not clear what I should recommend to the other team.
MapActivity inheritance complications are not relevant in our particular
case - it's just an Activity.
In our case:
The CordovaActivity already has all the well-tested lifecycle
implementations we need like onPause/onResume/onDestroy which are
correctly calling appView.handleXXX methods as required. They are also
using splashscreen logic etc.
A) If they cut/paste they end up with a heap of code they don't fully
understand (essentially the implementations of all those methods above),
and they also have to be careful of any future CordovaActivity changes
in case it overlaps code they previously cut. Actually, failing to call
a handlePause method correctly was where they came to grief in the first
place.
B) If they extend CordovaActivity then they get a lot of that for free
and might have avoided the situation they are in. Yes, they have to
override a bunch of other methods for initialization/layouts etc but I'm
guessing they probably had to implement some of those anyway.
--
I understand cringing over extending some huge class; seeing large slabs
of CordovaActivity Java code duplicated in user code is also
cringe-worthy.
Anyway, I have the impression that you recommend that we should not
extend CordovaActivity.
Is it a fair summary?
Thanks.
-----Original Message-----
From: Joe Bowser [mailto:bowserj@gmail.com]
Sent: Monday, 22 July 2013 12:11 PM
To: dev
Subject: Re: Embedding Cordova WebView on Android
On Jul 21, 2013 6:59 PM, "Anis KADRI" <an...@gmail.com> wrote:
>
> On Sun, Jul 21, 2013 at 6:48 PM, Joe Bowser <bo...@gmail.com> wrote:
>
> > Because there are things CordovaActivity does that you may not want,
>
>
> Such as ?
Initializing a WebView, creating layouts in code, handling intents,
everything that CordovaActivity does for the user by default.
>
> > also
> > there is no such thing as dual inheritance in Java.
>
>
> > For example if you have a MapActivity you can implement a
CordovaInterface,
> > but not extend a CordovaActivity.
> >
>
> As far as I understand the multiple inheritance is somewhat solved by
> implementing multiple interfaces but that is not really the issue
here.
>
It is, since CordovaWebView was created partly so it could be used as a
component inside of a MapActivity.
> Extending a class is easier for developers than implementing an
> interface because one can override methods instead of implementing
them.
>
>
True, but you can't extend a MapActivity and a CordovaActivity at the
same time.
People have to extended CordovaActivity, but when I see that it still
makes me cringe given how huge CordovaActivity still is.
Re: Embedding Cordova WebView on Android
Posted by Joe Bowser <bo...@gmail.com>.
On Jul 21, 2013 6:59 PM, "Anis KADRI" <an...@gmail.com> wrote:
>
> On Sun, Jul 21, 2013 at 6:48 PM, Joe Bowser <bo...@gmail.com> wrote:
>
> > Because there are things CordovaActivity does that you may not want,
>
>
> Such as ?
Initializing a WebView, creating layouts in code, handling intents,
everything that CordovaActivity does for the user by default.
>
> > also
> > there is no such thing as dual inheritance in Java.
>
>
> > For example if you have a MapActivity you can implement a
CordovaInterface,
> > but not extend a CordovaActivity.
> >
>
> As far as I understand the multiple inheritance is somewhat solved by
> implementing multiple interfaces but that is not really the issue here.
>
It is, since CordovaWebView was created partly so it could be used as a
component inside of a MapActivity.
> Extending a class is easier for developers than implementing an interface
> because one can override methods instead of implementing them.
>
>
True, but you can't extend a MapActivity and a CordovaActivity at the same
time.
People have to extended CordovaActivity, but when I see that it still makes
me cringe given how huge CordovaActivity still is.
Re: Embedding Cordova WebView on Android
Posted by Anis KADRI <an...@gmail.com>.
On Sun, Jul 21, 2013 at 6:48 PM, Joe Bowser <bo...@gmail.com> wrote:
> Because there are things CordovaActivity does that you may not want,
Such as ?
> also
> there is no such thing as dual inheritance in Java.
> For example if you have a MapActivity you can implement a CordovaInterface,
> but not extend a CordovaActivity.
>
As far as I understand the multiple inheritance is somewhat solved by
implementing multiple interfaces but that is not really the issue here.
Extending a class is easier for developers than implementing an interface
because one can override methods instead of implementing them.
>
> Also, we haven't fully tested the use case where one extends the
> CordovaActivity, so there's that as well.
> On Jul 21, 2013 6:26 PM, "Anis KADRI" <an...@gmail.com> wrote:
>
> > I would love to know that too.
> >
> >
> > On Sun, Jul 21, 2013 at 6:05 PM, Smith, Peter <
> peters@fast.au.fujitsu.com
> > >wrote:
> >
> > > Hi,
> > >
> > >
> > >
> > > I already asked this on PG Forum but got no replies. For more details
> > > see: https://groups.google.com/forum/#!topic/phonegap/KW0QC4P9P0Y
> > >
> > >
> > >
> > > --
> > >
> > >
> > >
> > > There is a Cordova Guide "Embedding Cordova WebView on Android"
> > >
> > >
> http://cordova.apache.org/docs/en/2.9.0/guide_cordova-webview_android.md
> > > .html#Embedding%20Cordova%20WebView%20on%20Android
> > >
> > >
> > >
> > > Can someone please explain why the guide advises to write the class
> with
> > > the form:
> > >
> > > public class CordovaViewTestActivity extends Activity implements
> > > CordovaInterface {
> > >
> > >
> > >
> > > instead of:
> > >
> > > public class CordovaViewTestActivity extends CordovaActivity {
> > >
> > >
> > >
> > > Our problem is that another team in our group has followed this
> > > cut/paste advice but then (since they've failed to maintain their code
> > > to keep up-to-date with changes to CordovaActivity over different
> > > versions) they have come to grief with unexpected behaviours. I thought
> > > if they had just extended from CordovaActivity in the first place they
> > > could have avoided such hassles, but OTOH they thought they were doing
> > > the right thing by following the guide.
> > >
> > >
> > >
> > > --
> > >
> > >
> > >
> > > Apologies if this is the wrong forum to ask this.
> > >
> > >
> > >
> > > Thanks,
> > >
> > > Peter
> > >
> > >
> >
>
Re: Embedding Cordova WebView on Android
Posted by Joe Bowser <bo...@gmail.com>.
Because there are things CordovaActivity does that you may not want, also
there is no such thing as dual inheritance in Java.
For example if you have a MapActivity you can implement a CordovaInterface,
but not extend a CordovaActivity.
Also, we haven't fully tested the use case where one extends the
CordovaActivity, so there's that as well.
On Jul 21, 2013 6:26 PM, "Anis KADRI" <an...@gmail.com> wrote:
> I would love to know that too.
>
>
> On Sun, Jul 21, 2013 at 6:05 PM, Smith, Peter <peters@fast.au.fujitsu.com
> >wrote:
>
> > Hi,
> >
> >
> >
> > I already asked this on PG Forum but got no replies. For more details
> > see: https://groups.google.com/forum/#!topic/phonegap/KW0QC4P9P0Y
> >
> >
> >
> > --
> >
> >
> >
> > There is a Cordova Guide "Embedding Cordova WebView on Android"
> >
> > http://cordova.apache.org/docs/en/2.9.0/guide_cordova-webview_android.md
> > .html#Embedding%20Cordova%20WebView%20on%20Android
> >
> >
> >
> > Can someone please explain why the guide advises to write the class with
> > the form:
> >
> > public class CordovaViewTestActivity extends Activity implements
> > CordovaInterface {
> >
> >
> >
> > instead of:
> >
> > public class CordovaViewTestActivity extends CordovaActivity {
> >
> >
> >
> > Our problem is that another team in our group has followed this
> > cut/paste advice but then (since they've failed to maintain their code
> > to keep up-to-date with changes to CordovaActivity over different
> > versions) they have come to grief with unexpected behaviours. I thought
> > if they had just extended from CordovaActivity in the first place they
> > could have avoided such hassles, but OTOH they thought they were doing
> > the right thing by following the guide.
> >
> >
> >
> > --
> >
> >
> >
> > Apologies if this is the wrong forum to ask this.
> >
> >
> >
> > Thanks,
> >
> > Peter
> >
> >
>
RE: Is there any method to let Cordova for Windows run
independently without IE.
Posted by 赵荣 <zh...@live.com>.
Got it, thank you
> Date: Wed, 24 Jul 2013 15:49:00 -0500
> Subject: Re: Is there any method to let Cordova for Windows run independently without IE.
> From: kerri@photokandy.com
> To: dev@cordova.apache.org
>
> Cordova relies on the system browser, and therefore would require IE 9 or
> higher be installed.
>
>
> On Sunday, July 21, 2013, 赵荣 <zh...@live.com> wrote:
> > Hi Dears, I have a question about Cordova for Windows.
> > I am making a web site, which needs customer pay online, however,
> because customers' browsers vary, the bank's payment plugin cannot work
> well on each customer's machine, I want to package a application by Cordova
> to provide customers with a uniform environment. I read the Cordova
> github notification, it says: "Internet Explorer 9 or newer is required.",
> does this mean there must be IE 9 or later on customer's computer? Is
> there any method to let Cordova run independently? such as embedding an IE
> or others...
> > Thank you very much!
> > Rong
>
> --
>
> ___________________________________
> Kerri Shotts
> photoKandy Studios, LLC
>
> On the Web: http://www.photokandy.com/
>
> Social Media:
> Twitter: @photokandy, http://twitter.com/photokandy
> Tumblr: http://photokandy.tumblr.com/
> Github: https://github.com/kerrishotts
> https://github.com/organizations/photokandyStudios
> CoderWall: https://coderwall.com/kerrishotts
>
> Apps on the Apple Store:
>
> https://itunes.apple.com/us/artist/photokandy-studios-llc/id498577828
>
> Books:
> http://www.packtpub.com/phonegap-2-mobile-application-hotshot/book
> http://www.packtpub.com/phonegap-social-app-development/book
Re: Is there any method to let Cordova for Windows run independently
without IE.
Posted by Kerri Shotts <ke...@photokandy.com>.
Cordova relies on the system browser, and therefore would require IE 9 or
higher be installed.
On Sunday, July 21, 2013, 赵荣 <zh...@live.com> wrote:
> Hi Dears, I have a question about Cordova for Windows.
> I am making a web site, which needs customer pay online, however,
because customers' browsers vary, the bank's payment plugin cannot work
well on each customer's machine, I want to package a application by Cordova
to provide customers with a uniform environment. I read the Cordova
github notification, it says: "Internet Explorer 9 or newer is required.",
does this mean there must be IE 9 or later on customer's computer? Is
there any method to let Cordova run independently? such as embedding an IE
or others...
> Thank you very much!
> Rong
--
___________________________________
Kerri Shotts
photoKandy Studios, LLC
On the Web: http://www.photokandy.com/
Social Media:
Twitter: @photokandy, http://twitter.com/photokandy
Tumblr: http://photokandy.tumblr.com/
Github: https://github.com/kerrishotts
https://github.com/organizations/photokandyStudios
CoderWall: https://coderwall.com/kerrishotts
Apps on the Apple Store:
https://itunes.apple.com/us/artist/photokandy-studios-llc/id498577828
Books:
http://www.packtpub.com/phonegap-2-mobile-application-hotshot/book
http://www.packtpub.com/phonegap-social-app-development/book
Is there any method to let Cordova for Windows run independently
without IE.
Posted by 赵荣 <zh...@live.com>.
Hi Dears, I have a question about Cordova for Windows.
I am making a web site, which needs customer pay online, however, because customers' browsers vary, the bank's payment plugin cannot work well on each customer's machine, I want to package a application by Cordova to provide customers with a uniform environment. I read the Cordova github notification, it says: "Internet Explorer 9 or newer is required.", does this mean there must be IE 9 or later on customer's computer? Is there any method to let Cordova run independently? such as embedding an IE or others...
Thank you very much!
Rong
Re: Embedding Cordova WebView on Android
Posted by Anis KADRI <an...@gmail.com>.
I would love to know that too.
On Sun, Jul 21, 2013 at 6:05 PM, Smith, Peter <pe...@fast.au.fujitsu.com>wrote:
> Hi,
>
>
>
> I already asked this on PG Forum but got no replies. For more details
> see: https://groups.google.com/forum/#!topic/phonegap/KW0QC4P9P0Y
>
>
>
> --
>
>
>
> There is a Cordova Guide "Embedding Cordova WebView on Android"
>
> http://cordova.apache.org/docs/en/2.9.0/guide_cordova-webview_android.md
> .html#Embedding%20Cordova%20WebView%20on%20Android
>
>
>
> Can someone please explain why the guide advises to write the class with
> the form:
>
> public class CordovaViewTestActivity extends Activity implements
> CordovaInterface {
>
>
>
> instead of:
>
> public class CordovaViewTestActivity extends CordovaActivity {
>
>
>
> Our problem is that another team in our group has followed this
> cut/paste advice but then (since they've failed to maintain their code
> to keep up-to-date with changes to CordovaActivity over different
> versions) they have come to grief with unexpected behaviours. I thought
> if they had just extended from CordovaActivity in the first place they
> could have avoided such hassles, but OTOH they thought they were doing
> the right thing by following the guide.
>
>
>
> --
>
>
>
> Apologies if this is the wrong forum to ask this.
>
>
>
> Thanks,
>
> Peter
>
>