• Skip to main content
  • Select language
  • Skip to search
MDN Web Docs
  • Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs / DOM
    • WebExtensions
    • MathML
  • References & Guides
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
Add-ons
  1. MDN
  2. Mozilla
  3. Add-ons
  4. Add-on SDK
  5. Tutorials
  6. Developing for Firefox Mobile

Developing for Firefox Mobile

In This Article
  1. Setting up the Environment
  2. Running Add-ons on Android
  3. Packaging Mobile Add-ons
  4. Module Compatibility
    1. High-Level APIs
    2. Low-Level APIs

Add-ons using the techniques described in this document are considered a legacy technology in Firefox. Don't use these techniques to develop new add-ons. Use WebExtensions instead. If you maintain an add-on which uses the techniques described here, consider migrating it to use WebExtensions.

Starting from Firefox 53, no new legacy add-ons will be accepted on addons.mozilla.org (AMO) for desktop Firefox and Firefox for Android.

Starting from Firefox 57, WebExtensions will be the only supported extension type. Desktop Firefox and Firefox for Android will not load other extension types.

Even before Firefox 57, changes coming up in the Firefox platform will break many legacy extensions. These changes include multiprocess Firefox (e10s), sandboxing, and multiple content processes. Legacy extensions that are affected by these changes should migrate to WebExtensions if they can. See the "Compatibility Milestones" document for more information.

A wiki page containing resources, migration paths, office hours, and more, is available to help developers transition to the new technologies.

See Developing WebExtensions for Firefox for Android to learn more about development of WebExtensions for Firefox for Android.

To follow this tutorial you'll need to have learned the basics of jpm.

Firefox for Android implements its UI using native Android widgets instead of XUL. With the add-on SDK you can develop add-ons that run on this new version of Firefox Mobile as well as on the desktop version of Firefox.

You can use the same code to target both desktop Firefox and Firefox Mobile, and use jpm-mobile instead of the normal jpm.

Right now not all modules are fully functional, but we're working on adding support for more modules. The tables at the end of this guide list the modules that are currently supported on Firefox Mobile.

This tutorial explains how to run SDK add-ons on an Android device connected via USB to your development machine. We'll use the Android Debug Bridge (adb) to communicate between the Add-on SDK and the device.

It's possible to use the Android emulator to develop add-ons for Android without access to a device, but it's slow, so for the time being it's much easier to use the technique described below.

Setting up the Environment

First you'll need an Android device capable of running the native version of Firefox Mobile. Then:

  • install the Nightly build of the native version of Firefox Mobile on the device.
  • enable USB debugging on the device (step 2 of this link only)

On the development machine:

  • install version 1.5 or higher of the Add-on SDK
  • install the correct version of the Android SDK for your device
  • using the Android SDK, install the Android Platform Tools

Next, attach the device to the development machine via USB.

Now open up a command shell. Android Platform Tools will have installed adb in the "platform-tools" directory under the directory in which you installed the Android SDK. Make sure the "platform-tools" directory is in your path. Then type:

adb devices

You should see some output like:

List of devices attached
51800F220F01564 device

(The long hex string will be different.)

If you do, then adb has found your device and you can get started.

Running Add-ons on Android

You can develop your add-on as normal, as long as you restrict yourself to the supported modules.

When you need to run the add-on, first ensure that Firefox is not running on the device. Then execute jpm-mobile run with some extra options:

jpm-mobile run --adb /path/to/adb

In the command shell, you should see something like:

Launching mobile application with intent name org.mozilla.fennec
Pushing the addon to your device
Starting: Intent { act=android.activity.MAIN cmp=org.mozilla.fennec/.App (has extras) }
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
Could not read chrome manifest 'file:///data/data/org.mozilla.fennec/chrome.manifest'.
info: starting
info: starting
zerdatime 1329258528988 - browser chrome startup finished.

This will be followed by lots of debug output.

On the device, you should see Firefox launch with your add-on installed.

console.log() output from your add-on is written to the command shell, just as it is in desktop development. However, because there's a lot of other debug output in the shell, it's not easy to follow. The command adb logcat prints adb's log, so you can filter the debug output after running the add-on. For example, on Mac OS X or Linux you can use a command like the one below to filter only the lines of console output:

adb logcat | grep console

You can experiment with different filter strings on adb logcat to focus in on the lines relevant to you.

Running jpm-mobile test is identical:

jpm-mobile test --adb /path/to/adb

Packaging Mobile Add-ons

To package a mobile add-on as an XPI, use the command:

jpm xpi

Actually installing the XPI on the device is a little tricky. The easiest way is probably to copy the signed XPI somewhere on the device:

adb push my-addon.xpi /mnt/sdcard/

Then open Firefox Mobile and type this into the address bar:

file:///mnt/sdcard/my-addon.xpi

The browser should open the XPI and ask if you want to install it.

Afterwards you can delete it using adb as follows:

adb shell
cd /mnt/sdcard
rm my-addon.xpi

Module Compatibility

Modules not supported in Firefox Mobile are marked in the tables below.

High-Level APIs

addon-page Not supported
base64 Supported
clipboard Not supported
context-menu Not supported
hotkeys Supported
indexed-db Supported
l10n Supported
notifications Supported
page-mod Supported
page-worker Supported
panel Not supported
passwords Supported
private-browsing Not supported
querystring Supported
request Supported
selection Not supported
self Supported
simple-prefs Supported
simple-storage Supported
system Supported
tabs Supported
timers Supported
ui Not supported
url Supported
widget Not supported
windows Supported

Low-Level APIs

/loader Supported
chrome Supported
console/plain-text Supported
console/traceback Supported
content/content Supported
content/loader Supported
content/mod Supported
content/worker Supported
core/heritage Supported
core/namespace Supported
core/promise Supported
event/core Supported
event/target Supported
frame/hidden-frame Supported
frame/utils Supported
io/byte-streams Supported
io/file Supported
io/text-streams Supported
lang/functional Supported
lang/type Supported
loader/cuddlefish Supported
loader/sandbox Supported
net/url Supported
net/xhr Supported
places/bookmarks Not supported
places/favicon Not supported
places/history Not supported
platform/xpcom Supported
preferences/service Supported
stylesheet/style Supported
stylesheet/utils Supported
system/environment Supported
system/events Supported
system/runtime Supported
system/unload Supported
system/xul-app Supported
tabs/utils Supported
test/assert Supported
test/harness Supported
test/httpd Supported
test/runner Supported
test/utils Supported
ui/button/action Not supported
ui/button/toggle Not supported
ui/frame Not supported
ui/id Supported
ui/sidebar Not supported
ui/toolbar Not supported
util/array Supported
util/collection Supported
util/deprecate Supported
util/list Supported
util/match-pattern Supported
util/object Supported
util/uuid Supported
window/utils Supported

 

Document Tags and Contributors

Tags: 
  • Add-on SDK
 Contributors to this page: Rob W, wbamberg, creesch, carlsmith, maybe, jsantell, Canuckistani
 Last updated by: Rob W, Jun 12, 2017, 3:00:51 AM
See also
  1. WebExtensions
  2. Getting started
    1. What are WebExtensions?
    2. Your first WebExtension
    3. Your second WebExtension
    4. Anatomy of a WebExtension
    5. Example WebExtensions
  3. How to
    1. Intercept HTTP requests
    2. Modify a web page
    3. Add a button to the toolbar
    4. Implement a settings page
  4. User interface
    1. Introduction
    2. Toolbar button
    3. Address bar button
    4. Sidebar
    5. Context menu items
    6. Options page
    7. Bundled web pages
    8. Notifications
    9. Address bar suggestions
    10. Developer tools panels
  5. Concepts
    1. Using the JavaScript APIs
    2. Content scripts
    3. Match patterns
    4. Internationalization
    5. Content Security Policy
    6. Native messaging
  6. Porting
    1. Porting a Google Chrome extension
    2. Porting a legacy Firefox add-on
    3. Embedded WebExtensions
    4. Comparison with the Add-on SDK
    5. Comparison with XUL/XPCOM extensions
    6. Chrome incompatibilities
  7. Firefox workflow
    1. Temporary Installation in Firefox
    2. Debugging
    3. Getting started with web-ext
    4. web-ext command reference
    5. WebExtensions and the Add-on ID
    6. Publishing your WebExtension
  8. JavaScript APIs
    1. Browser support for JavaScript APIs
    2. alarms
    3. bookmarks
    4. browserAction
    5. browsingData
    6. commands
    7. contextMenus
    8. contextualIdentities
    9. cookies
    10. devtools.inspectedWindow
    11. devtools.network
    12. devtools.panels
    13. downloads
    14. events
    15. extension
    16. extensionTypes
    17. history
    18. i18n
    19. identity
    20. idle
    21. management
    22. notifications
    23. omnibox
    24. pageAction
    25. permissions
    26. privacy
    27. proxy
    28. runtime
    29. sessions
    30. sidebarAction
    31. storage
    32. tabs
    33. topSites
    34. types
    35. webNavigation
    36. webRequest
    37. windows
  9. Manifest keys
    1. applications
    2. author
    3. background
    4. browser_action
    5. chrome_settings_overrides
    6. chrome_url_overrides
    7. commands
    8. content_scripts
    9. content_security_policy
    10. default_locale
    11. description
    12. developer
    13. devtools_page
    14. homepage_url
    15. icons
    16. incognito
    17. manifest_version
    18. name
    19. omnibox
    20. optional_permissions
    21. options_ui
    22. page_action
    23. permissions
    24. protocol_handlers
    25. short_name
    26. sidebar_action
    27. version
    28. web_accessible_resources
  10. Add-on SDK
  11. Getting started
    1. Installation
    2. Getting started
    3. Troubleshooting
  12. High-Level APIs
    1. addon-page
    2. base64
    3. clipboard
    4. context-menu
    5. hotkeys
    6. indexed-db
    7. l10n
    8. notifications
    9. page-mod
    10. page-worker
    11. panel
    12. passwords
    13. private-browsing
    14. querystring
    15. request
    16. selection
    17. self
    18. simple-prefs
    19. simple-storage
    20. system
    21. tabs
    22. timers
    23. ui
    24. url
    25. webextension
    26. widget
    27. windows
  13. Low-Level APIs
    1. /loader
    2. chrome
    3. console/plain-text
    4. console/traceback
    5. content/content
    6. content/loader
    7. content/mod
    8. content/symbiont
    9. content/worker
    10. core/heritage
    11. core/namespace
    12. core/promise
    13. dev/panel
    14. event/core
    15. event/target
    16. frame/hidden-frame
    17. frame/utils
    18. fs/path
    19. io/byte-streams
    20. io/file
    21. io/text-streams
    22. lang/functional
    23. lang/type
    24. loader/cuddlefish
    25. loader/sandbox
    26. net/url
    27. net/xhr
    28. places/bookmarks
    29. places/favicon
    30. places/history
    31. platform/xpcom
    32. preferences/event-target
    33. preferences/service
    34. remote/child
    35. remote/parent
    36. stylesheet/style
    37. stylesheet/utils
    38. system/child_process
    39. system/environment
    40. system/events
    41. system/runtime
    42. system/unload
    43. system/xul-app
    44. tabs/utils
    45. test/assert
    46. test/harness
    47. test/httpd
    48. test/runner
    49. test/utils
    50. ui/button/action
    51. ui/button/toggle
    52. ui/frame
    53. ui/id
    54. ui/sidebar
    55. ui/toolbar
    56. util/array
    57. util/collection
    58. util/deprecate
    59. util/list
    60. util/match-pattern
    61. util/object
    62. util/uuid
    63. window/utils
  14. Firefox for Android
  15. Getting started
    1. Walkthrough
    2. Debugging
    3. Code snippets
  16. APIs
    1. Accounts.jsm
    2. BrowserApp
    3. HelperApps.jsm
    4. Home.jsm
    5. HomeProvider.jsm
    6. NativeWindow
    7. Notifications.jsm
    8. PageActions.jsm
    9. Prompt.jsm
    10. RuntimePermissions.jsm
    11. Snackbars.jsm
    12. Sound.jsm
    13. Tab
  17. Legacy
  18. Restartless extensions
    1. Overview
  19. Overlay extensions
    1. Overview
  20. Themes
  21. Lightweight themes
    1. Overview
  22. Complete themes
    1. Overview
  23. Publishing add-ons
  24. Guides
    1. Signing and distribution overview
    2. Submit an add-on
    3. Review policies
    4. Developer agreement
    5. Featured add-ons
    6. Contact addons.mozilla.org
  25. Community and support
  26. Channels
    1. Add-ons blog
    2. Add-on forums
    3. Stack Overflow
    4. Development newsgroup
    5. IRC Channel