Revert "Address even more lint errors." This reverts commit e98ee991b34d318e671c644d63daec53902e68ff. Revert "Update to Gradle 6.6.1." This reverts commit cdda701c8f2be6c0486ddf1494885accf78aab00. Revert "Address lint errors." This reverts commit 26cb5b27bc2be672c89e7e0c63eeeda9f64c0d08. Revert "Move JNA configuration to root project." This reverts commit 694ef37cc30e727f3ec5d275c0e9583385980a43. Revert "Issue https://github.com/mozilla-mobile/android-components/issues/8319: Update to Kotlin 1.4, Coroutines 1.3.9 and Android lint 27.0.1." This reverts commit ad675c35e794050dbf8514a2d2fe7506ce0c546c. Revert "Update Glean to 33.0.4." This reverts commit 4731c4e2fa52d40f4062a47f02078ca0c85de632. Revert "Update Glean to 33.0.0." This reverts commit 352cf88a4d4bad64330d0ec997814fd8b13928c2. Revert "Update Gradle to 6.1.1." This reverts commit 18e88aa1a2528b10f7d81ff9dbf1df094071b6ce. Revert "Update Android Gradle Plugin to 4.0.1." This reverts commit f915a3b47b0f5584889ff62a80c9642bccfa36ce. |
||
|---|---|---|
| .. | ||
| src | ||
| build.gradle | ||
| proguard-rules.pro | ||
| README.md | ||
Android Components > Browser > Engine-System
Engine implementation based on the system's WebView.
Usage
See concept-engine for a documentation of the abstract engine API this component implements.
Setting up the dependency
Use Gradle to download the library from maven.mozilla.org (Setup repository):
implementation "org.mozilla.components:browser-engine-system:{latest-version}"
Initializing
It is recommended t create only one SystemEngine instance per app.
// Create default settings (optional) and enable tracking protection for all future sessions.
val defaultSettings = DefaultSettings().apply {
trackingProtectionPolicy = EngineSession.TrackingProtectionPolicy.all()
}
// Create an engine instance to be used by other components.
val engine = SystemEngine(defaultSettings)
Integration
Usually it is not needed to interact with the Engine component directly. The browser-session component will take care of making the state accessible and link a Session to an EngineSession internally. The feature-session component will provide "use cases" to perform actions like loading URLs and takes care of rendering the selected Session on an EngineView.
View
SystemEngineView is the Gecko-based implementation of EngineView in order to render web content.
<mozilla.components.browser.engine.system.SystemEngineView
android:id="@+id/engineView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
SystemEngineView can render any SystemEngineSession using the render() method.
val engineSession = engine.createSession()
val engineView = view.findViewById<SystemEngineView>(R.id.engineView)
engineView.render(engineSession)
License
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/