Firefox for Android supports add-ons using the same extension system used by all other Gecko-based applications. You can use WebExtensions, the Add-on SDK or build manually bootstrapped restartless add-ons. You can even develop traditional restart-required add-ons, although WebExtensions are preferable.
Add-ons that work with desktop Firefox do not automatically work in Firefox for Android:
- There is no visible XUL in the UI, so you can't use an overlay to create the UI.
- Internal code and objects, like
gBrowser, do not exist. Look at the Firefox on Android
browser.jsfile to learn about the internals. Much of the same fundamental functionality exists.
- Services like
nsIAlertsServiceare implemented to use native Android UI.
NativeWindow, that allows you to manipulate parts of the native Android UI.
The following articles provide help with developing extensions for Firefox on Android. In addition, please refer to the general extension documentation that applies to all Mozilla applications.
- Setting up your desktop to write addons and push them to device, and how to test snippets from Desktop straight on your connected device.
- Debugging Firefox for Android with WebIDE
- Article from the Prerequisites tutorial, add-on debugging and snippet testing is not possible without the WebIDE.
- Developing, packaging and installing a simple add-on for Firefox for Android.
- Firefox Hub Walkthrough
- How to develop a Firefox Hub add-on to add content to the Firefox for Android home page.
- Add-on SDK
- How to develop Firefox for Android add-ons using the Add-on SDK.
- Code Snippets
- Code samples for common tasks.
- Initialization and Cleanup
- How to initialize your add-on when it is started and clean up when it is shut down.
- Firefox for Android Add-ons Github Repo
- A collection of JS modules, sample code, and boilerplate repos to help you build add-ons for Firefox for Android.
- Create native Android UI widgets.
- Access browser tabs and the web content they host.
- Show native Android dialogs.
- Query and launch native apps installed on the system.
- Use extended properties for Android system notifications.
- Customize the home page.
- Store data to display on the home page.
- Display page-specific actions in the URL bar.
- Tap into the native Java Android API from addons.
- Play sounds in the browser simply.