Android Components > Feature > P2P
A feature that enables sharing of URLs and web pages through peer-to-peer wifi
connections. Because this does not inline external references to images and CSS,
the page on the recipient device will lack those features unless connected to the Internet.
It works best in conjunction with feature-readerview
.
Use Gradle to download the library from maven.mozilla.org (Setup repository):
implementation "org.mozilla.components:feature-p2p:{latest-version}"
The P2P toolbar has been integrated into samples/browser
. Key files are:
BaseBrowserFragment
, which instantiatesP2PIntegration
and supports permission granting.P2PIntegration
, which instantiatesP2PFeature
and contains code to launch and close the toolbar.DefaultComponents
, which lazily provides a NearbyConnection and adds the toolbar to the settings menu.fragment_browser.xml
, which includes theP2PBar
widget.
The structure of the feature is shown in this block diagram:
An experimental fork uses the
external library freeze-dry
to package up the entire
web page. This version was not checked in to this repository because reviewing all of the JavaScript
code was infeasible. Performance was also an issue.
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/