Confirmed users
414
edits
Line 9: | Line 9: | ||
== Using GeckoView == | == Using GeckoView == | ||
# | # Add Nightly taskcluster repo to your build.gradle | ||
# Add | |||
<pre> | |||
repositories { | |||
maven { | |||
# | url 'https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.latest.mobile.android-api-16-opt/artifacts/public/android/maven' | ||
} | |||
} | |||
</pre> | |||
# Add geckoview to dependencies | |||
Again, in build.gradle | |||
<pre> | |||
dependencies { | |||
compile 'org.mozilla:geckoview-nightly-armeabi-v7a:+' | |||
} | |||
</pre> | |||
This will always use the latest Nightly in the repository. As GeckoView development continues, we will have Beta and Release repositories that have the expected version names (61.0.0, etc). | |||
# Using GeckoView | |||
You can now use GeckoView your app by including the following in a layout XML file: | You can now use GeckoView your app by including the following in a layout XML file: | ||
Line 28: | Line 46: | ||
<pre> | <pre> | ||
// Find the GeckoView in our layout | onCreate(...) { | ||
GeckoView geckoView = (GeckoView) findViewById(R.id.geckoview); | // Find the GeckoView in our layout | ||
GeckoView geckoView = (GeckoView) findViewById(R.id.geckoview); | |||
// Attach the GeckoView to a new GeckoSession | // Attach the GeckoView to a new GeckoSession | ||
GeckoSession session = new GeckoSession(); | GeckoSession session = new GeckoSession(); | ||
geckoView.setSession(session); | geckoView.setSession(session); | ||
// Load a URL | // Load a URL | ||
session.loadUri("http://mozilla.com"); | session.loadUri("http://mozilla.com"); | ||
} | |||
</pre> | </pre> | ||