GeckoView: Embedding Gecko in your Android Application

Firefox for Android is a great browser, bringing a modern HTML rendering engine to Android 2.2 and newer. One of the things we have been hoping to do for a long time now is make it possible for other Android applications to embed the Gecko rendering engine. Over the last few months we started a side project to make this possible. We call it GeckoView.

As mentioned in the project page, we don’t intend GeckoView to be a drop-in replacement for WebView. Internally, Gecko is very different from Webkit and trying to expose the same features using the same APIs just wouldn’t be scalable or maintainable. That said, we want it to feel Android-ish and you should be comfortable with using it in your applications.

We have started to build GeckoView as part of our nightly Firefox for Android builds. You can find the library ZIPs in our latest nightly FTP folder. We are in the process of improving the APIs used to embed GeckoView. The current API is very basic. Most of that work is happening in these bugs:

I would love to see a tool to migrate an existing web app to a fully fledged Android application embedding the web app into a Gecko view (like phonegap/cordova but without the need to run on the file:// scheme). Any plan to go that direction ?

Great work!
I’m working with a large hybrid app for language learning. The initial test we’ve made with GeckoView shows greatly improved rendering performance and html5 media API support compared with WebView. Especially on low end devices. Keep up the good work!

nice to see something like GeckoView coming to developers. I was wondering if there are any informations about the supported HTML5 features if using GeckoView. Did one get full Firefox features if using GeckoView and not WebView? Keep up the good work on GeckoView and Firefox!!

GeckoView can’t work when phone is horizontal?
I need the app to be horizontal, so I add this statements to “onCreate”:
if(getRequestedOrientation()!=ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE){
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

and this statement will cause the app can’t be started( it opend, and then quit immediately) , if I remove this statement, the app can open normally, and display web page correctly vertically.

and then , if I rotate my phone to horizontal, the geckoView became a white screen.

I don’t mind the 18MB bump if that means you can use a modern browser. for Android web apps. To me, the built in Android browser is like the IE of old, but then for mobile devices.

Working on a hybrid app at the moment and the stock browser is just pitiful, along with the update process on android which is pretty much non-existant make it a royal pain to develop a proper web app for it.

Already tried the chromium view(s) to improve the app, I’m highly curious what GeckoView can do. By the way, is there a way to load local files which are packaged alongside GeckoView? It looks like it’s a packaged browser from the screens but I can be mistaken, will need to fiddle.

@Scott – This is a bug in GeckoView. Firefox does the same thing, but we have code in Firefox to manage the config changes ourselves. You could do that in your app too, but we really want to fix this in GeckoView somehow.

The reason it happens is because Android will destroy the Activity, and GeckoView, on rotation. So GeckoView loses it’s connection to Gecko.

@RonMen – Yes, GeckoView should have the same HTML5 support as Firefox. The only reason I can’t say “does have” is we didn’t hook up some of the Android support code up to GeckoView yet, but it is hooked up in Firefox. Things like the Location provider, Network provider and Battery provider – all of which feed into some HTML5 APIs like Geolocation, Network activity and Battery status APIs.