From MozillaWiki
Jump to: navigation, search

Fennec implements support for Mozilla's WebApp APIs. In order to get the experience close to feeling "native" on Android, we needed to make some tradeoffs. This page documents the current implementation and some ideas for the future.

Current Implementation

Android does not make it easy to create "fake" applications, or install real applications from places other than the Play Store or for applications to share libraries. The current WebApp implementation on Android needs to work around some of these issues, as well as internal Gecko on Android issues. Here is a punch list of requirements and limitations:

  • Run each webapp in it's own profile
    • Nice for data privacy
    • More like native apps on Android
  • Run each webapp as a separate process
    • Nice for crash protection
    • More like native apps on Android
    • Shows as individual apps in the "Recent Apps List" on Android
    • Gecko can only use one GL surface per activiy
  • We have a hard coded limit of 100 webapp processes
    • The processes must be identified in the Android Manifest and can't be added at runtime
    • The manifest controls how the activities will be launched
    • The manifest also controls the icon and name used in the "Recent Apps List" on Android
  • Run in a chromeless activity, with no browser UI
    • More like native apps on Android
  • On install, show a system notification and create a shortcut on the Android homescreen
    • A reference is added to the Gecko webapp database, allowing permissions and navigator.apps APIs to work
    • The shortcut is the extent of the app existing in Android. It's not a real APK.
    • Since these apps are fake, they do not appear in "All Apps" list on Android
  • Plain URLs cannot be launched in the chromeless activity
    • The installation process creates a registry in the Gecko webapp database, which is checked during launch
    • Not easy to allow launchers like to show webapps in a chromeless activity
  • Uninstalling is only really controlled by Gecko
    • Removing the shortcut from the homescreen will not automatically uninstall the app
    • Android does not fire an event when a shortcut is removed, so we can't listen for anything
  • The "Recent Apps List" does not show the webapp's name or icon
    • The data is pulled from the AndroidManifest which can't be updated at runtime

Some short term ideas that might help address some of the current problems:

  • Hide webapps from the "Recent Apps List". It looks bad (name and icon are bogus) and we could let users find other ways to switch to the apps.
  • Create a special intent for opening plain URLs in a chromeless activity. This would allow to open web sites in an app-like window. We'd probably treat these URLs as fake webapps, living in a separate process and using a separate profile.

Future Ideas


We could create a widget, which shows webapp launcher icons

  • The webapps would automatically show up as they are installed
  • Removing a shortcut from inside the widget would really uninstall the webapp
  • For people with a lot of webapps, a single widget might not be enough real estate. Can we create multiple widgets on different homescreens?
  • Widgets might make it hard for people to organize webapps like they can with native apps


We could create our own Android Launcher. This would allow us to mix native apps and webapps together seamlessly.

  • Not a small project. The basic requirements for an Android Launcher are not small.
  • We'd need to handle multiple versions of Android
  • We would be competing with a new market of apps (Launchers) and adding features to compete well.
  • Launchers are optional for users, so we might not be able to supply a webapp solution to most of our user base. People would need to use the Launcher to get support for webapps.

Separate APKs

We could create APKs for each webapp.

  • Marketplace would bundle and sign the APK
  • Firefox would download and install the APK
    • Users would need to enable "Untrusted sources" on their device to allow the install
  • We could not bundle Gecko inside each APK, so we would still depend on Firefox to act as the runtime
  • Running the APK app would cause Firefox to install a webapp reference in the Gecko webapp database allowing the navigator.apps API to work correctly
  • The webapp would be displayed in the "All Apps" list.
  • The webapp would be displayed in the "Recent Apps List" and use the icon and name from the APK
    • The APK app would be a dummy and we'd need to forward "activation" events to the Firefox process
  • Uninstalling the APK should be enough to trigger an event for Firefox to uninstall the webapp from the Gecko webapp database