Mobile/GeckoView: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 6: Line 6:


== Using GeckoView ==
== Using GeckoView ==
1. Download and unzip geckoview_library.zip and geckoview_assets.zip from [URL]
2. Open Eclipse and import the GeckoView library project by doing File > Import.
3. Set the imported GeckoView library project as a dependency in your app. [SCREENSHOTS]
4. Copy the assets folder from the geckoview_assets.zip to your app's assets folder.
5. Add "manifestmerger.enabled=true" to your project's project.properties file.
Your directory structure should look like the following:
[SCREENSHOT]
You can now use GeckoView your app by including the following in a layout XML file:
<pre>
<org.mozilla.gecko.GeckoView
  android:id="@+id/geckoview"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content" />
</pre>
You can then load a page in your code with:
<pre>
GeckoView geckoView = (GeckoView) findViewById(R.id.geckoview);
geckoView.loadUrlInNewTab("http://mozilla.com");
</pre>


== Example App ==
== Example App ==

Revision as of 23:51, 21 August 2013

What is GeckoView

GeckoView is an Android library project that allows third-party developers to use Gecko as an Android View in their own applications. GeckoView is similar to Android's built in WebView, but it is not a drop in replacement for WebView.

Note that GeckoView is NOT ready to be used in a production environment. It is currently possible to load webpages, but that's about it.

Using GeckoView

1. Download and unzip geckoview_library.zip and geckoview_assets.zip from [URL] 2. Open Eclipse and import the GeckoView library project by doing File > Import. 3. Set the imported GeckoView library project as a dependency in your app. [SCREENSHOTS] 4. Copy the assets folder from the geckoview_assets.zip to your app's assets folder. 5. Add "manifestmerger.enabled=true" to your project's project.properties file.

Your directory structure should look like the following: [SCREENSHOT]

You can now use GeckoView your app by including the following in a layout XML file:

<org.mozilla.gecko.GeckoView
  android:id="@+id/geckoview"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content" />

You can then load a page in your code with:

GeckoView geckoView = (GeckoView) findViewById(R.id.geckoview);
geckoView.loadUrlInNewTab("http://mozilla.com");

Example App