AIDE/PhoneGap with Chrome WebView instead of Android LameView?

947 views
Skip to first unread message

Alice Fleury

unread,
Mar 2, 2014, 3:37:39 AM3/2/14
to andro...@googlegroups.com
Hi,
I was just wondering if in the future AIDE/PhoneGap could build with a custom Chrome WebView instead of the default Android WebView? I'm pretty sure development on the Android WebView has been abandoned by Google in favor of the Chrome WebView. Also, the Android WebView is pretty extensively out of date for web features(even for a mobile). It makes developing a webapp for AIDE/PhoneGap pretty annoying. Also the Android WebView is slow. I'm a paying customer, btw. Three times. I bought AIDE Premium, the UI Designer, and AIDE/PhoneGap. Pleeeeease make AIDE/PhoneGap use the Chrome WebView? Even if it's optional to allow for building PhoneGap apps for older versions of Android that don't support the Chrome WebView. Anyways, thank you for your products, they are great.

anthropi...@gmail.com

unread,
Mar 2, 2014, 10:00:06 PM3/2/14
to andro...@googlegroups.com
Just a terminolgy pickiness: webview is the name for a browser that has its roots in apple, google worked pretty hard to get it cross platform, and as of kitkat, are still updating it
See, it's not a browser that you are including in your program, if that were the case, I'd be telling you how to bring in your own browser ( you can bring in your own browser, but do you really want to go about doing that? Consider what that would do to your app size and what you would have to do wrt keeping up on browser exploits and memory leaks! )
Webview is an interface supported by a browser that is sitting on everyone's Android. Check out the AOSP if you want to get into the nitty-gritty, but here's the take home: assuming you implemented it correctly ( read about Websettings, ChromeClient, WebviewClient here: http://developer.android.com/reference/android/webkit/WebView.html ) what is supported in your webview depends on the user's device, and for that, there's good news: as of kitkat, webview is backed by chromium.

Also, consider what you are using webview for and if you need to hire a native developer. =]

is a bit snarky, but illustrative; straight wrappers will always be janky, but some houses do impressive work with hybrids e.g. facebook's app circa 2012

shanti
-AnBr
Message has been deleted

Andrew Byrne

unread,
Mar 4, 2014, 4:18:36 AM3/4/14
to Alice Fleury, andro...@googlegroups.com

Hey Alice =]
You've caught me on a rant-y day, so you'll get a full answer; we can talk further off list, because this venue isn't appropriate, as should be clear by the middle of 'graf 5, but I'll post this for posterity.

Now, pardon the assumption, but I think my reply isn't helpful partly because you think you're writing a native app.
A native app that gets data from the web would involve implementing a HttpRequestFactory or something similar.
What one does in PhoneGap/Cordova is write scripts( and a DOM ) that call methods implemented by the phone's webview and also( and here's the hybrid! ) native methods you can implement in Java--in libraries compiled alongside the Cordova/PhoneGap libraries; these scripts are downloaded when the app starts and makes a request to the webpage by calling the getUrl method in a webView.

From http://phonegap.com/2012/05/02/phonegap-explained-visually/
"The web view used by PhoneGap is the same web view used by the native operating system.   On iOS, this is the Objective-C UIWebView class; on Android, this is android.webkit.WebView.  Since there are differences in the web view rendering engines between operating systems, make sure that you account for this in your UI implementation." [ed: UI implementation = mobile web HTML5/CSS3]

So we can agree then, that what PhoneGap/Cordova does is reference the web view used by the OS, yes? You can look in https://github.com/apache/cordova-android and you won't find the v8 library, we agree on that, right? ...we also agree that Apache/Adobe produces PhoneGap/Cordova, yes? Not the Android Integrated Development Environment team? Some of us were putting Cordova libraries in our apps via AIDE long before they made the in-app template =]

I'd like to commiserate with you: yes, google isn't doing much to update webview on old phones, but you're barking up the wrong tree asking the team that writes what is essentially a text editor on steroids( vim is an IDE too! =] ) to do that for you; if you want to do the nastiest polyfill known to droidkind, you are best off scouring github for some poor soul who keeps a wrapper up for the chrome engine, submodule that, and then worry every day that they'll take a vacation or wreck your interface; the link you provided could be such a resource.
I'll ask you again: do you want to have to patch and issue updates to your app every time Google updates chrome? Just thinking of that, I see every free moment of my life burning away like butterflies in a firestorm, and thankfully, that is not what Cordova/PhoneGap does.

I think you'd really enjoy reading up on what 'interface' means, particularly in Java; it's because of the power of that concept that you don't need to exclusively target Kitkat devices to get a PhoneGap app that works middlingly well on newer phones, and like-crunk-but-still-rendering on older ones; it's also why the -webkit- standards are strongly influenced by Apple devs, but we can use them here in aOS...

Lastly--and I think addressing your point directly--as for the dream of making one website for mobile and web--you can pass the marley over to Zuckerberg; they tilted at that windmill for *years*.
In the end, webView/chromium based apps will only asymptotically approach the performance of native apps--arm processors run js 4X slower than x86, js runs 10X slower than Java, and we already split our cores--and frankly, because there is no getting around that is why we droidgrammers continue to make the salaries we do.

And as such, here's my absolutely free advice to you: if you are committed to running scripts on a mobile device, make sure you are using very standard libraries( read: jquery mobile ), that they are cached--not downloaded repeatedly--and that they are brief and to the point i.e. if you detect your website is being loaded by your client their steady state should be stored in native Java methods--a hybrid.
Dollars to donuts, it isn't that your scripts aren't being supported, it's that they are hanging because they are scripts running on a resource-constrained machine.
http://caniuse.com/#agents=mobile&cats=JS_API (check out android browser!)

And this bears repeating: if you are actually concerned about performance--if your users are not 1. a VC or 2. obliged, and might slip away if they have to wait more than 7-12 seconds--hire a native developer.

I hope this was more informative =]
shanti
-AnBr

On Mar 3, 2014 9:31 PM, "Alice Fleury" <alic...@gmail.com> wrote:
I don't think you understood what I was saying, because you're reply wasn't helpful and didn't indicate understanding.
I was talking about maybe including something like this: https://github.com/pwnall/chromeview
Which would make up for Android 4.0, for example, lacking support for the Chrome Webview widget. And lacking the Chrome Webview version of the widget means that web apps created with AIDE/PhoneGap on pre-kitkat devices are missing significant support for web standards. I don't know if you really noticed, but development on older versions of Android(out of date ones) is generally zero. So unless I buy a new KitKat phone and only target KitKat devices I can't even release a working worth while native webapp using AIDE/PhoneGap and a normal webapp at the same time using the same code. Kind of defeats the purpose of AIDE/PhoneGap, doesn't it?

Alice Fleury

unread,
Mar 4, 2014, 4:44:54 AM3/4/14
to andro...@googlegroups.com, Alice Fleury, anthropi...@gmail.com
My scripts don't load off the network, and it's not that they aren't supported, it's that the webview class doesn't have requestAnimationFrame. :-P
My script works fine, it's just the webview is really out of date and enabling AIDE/PhoneGap to use an AIDE/PhoneGap supplied Chromium based webview class would be awesome. I dunno what's with you an assuming so much, you are waaaay off. It's a bit insulting how you insinuate I'm really stupid without just outright saying it. :-(
Anyways, it was just a thought.

Andrew Byrne

unread,
Mar 4, 2014, 5:41:00 AM3/4/14
to Alice Fleury, andro...@googlegroups.com

Unbelievably, this is me being nice.
1. webView--Chromium-based or otherwise--is not a class supplied by PhoneGap, and AIDE is merely supplying you with the PhoneGap libraries/classes.
2. I recommend you research interfaces as they apply to Java; consider webView as such an interface.
3. You are barking up the wrong tree, asking this of your text editor/compiler; the interface is implemented in the OS; truthfully, you be better off petitioning Google and then every data provider to push an update.
4. You really, really, really don't want to package a web browser in your app.
5. I cannot believe you are calling WebView.requestAnimationFrame from a native Java class; you must be calling it from js, but http://caniuse.com/requestanimationframe you'd have to be using pre-2.1(I think Froyo?) to see that js library not supported by the LameView.

For the record, I don't think you are stupid, I can see you just have the wrong frame of reference/definitions, and I seemingly cannot show you the right ones.
best

Alice Fleury

unread,
Mar 4, 2014, 6:12:02 AM3/4/14
to andro...@googlegroups.com, Alice Fleury, anthropi...@gmail.com

Alice Fleury

unread,
Mar 4, 2014, 6:16:03 AM3/4/14
to andro...@googlegroups.com, Alice Fleury, anthropi...@gmail.com

Alice Fleury

unread,
Mar 4, 2014, 6:30:38 AM3/4/14
to andro...@googlegroups.com
For anyone interested, this is the solution to the window.requestAnimationFrame not being their problem:

(function() {
    var lastTime = 0;
    var startTime = new Date().getTime();
    var vendors = ['ms', 'moz', 'webkit', 'o'];
    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
        window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] 
                                   || window[vendors[x]+'CancelRequestAnimationFrame'];
    }

    if (!window.requestAnimationFrame)
        window.requestAnimationFrame = function(callback, element) {
            var currTime = new Date().getTime();
            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
            var id = window.setTimeout(function() { callback(currTime - startTime); }, 
              timeToCall);
            lastTime = currTime + timeToCall;
            return id;
        };

    if (!window.cancelAnimationFrame)
        window.cancelAnimationFrame = function(id) {
            clearTimeout(id);
        };
}());
Reply all
Reply to author
Forward
0 new messages