Mobile/GeckoView: Difference between revisions

Jump to navigation Jump to search
Line 9: Line 9:
== Using GeckoView ==
== Using GeckoView ==


# Download a recent GeckoView AAR from treeherder (mozilla-central tree). The AAR is available from the 'Android API16+ Gradle opt' job under the 'Bng' symbol. After clicking that, there is a link to 'geckoview-0.0.1.aar' in the bottom pane.
# Add Nightly taskcluster repo to your build.gradle
# Add the GeckoView AAR to your Gradle / Android Studio project. In Android Studio you can add the .aar as follows:
 
## Move the geckoview aar to your project's 'app/libs' folder.
<pre>
## Use the 'New Module' option under the 'File' menu.
repositories {
## Import the .aar file.
    maven {
## Add the new GeckoView AAR module as a dependency to the application.
      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>


Confirmed users
414

edits

Navigation menu