Custom Ringtones for FirefoxOS

In FirefoxOS versions 1.0 and 1.1 the Settings app handles ringtone selection and the user’s choices are hard-coded into that app.  In version 1.2, I’ve changed the Settings app to use Web Activities instead.  Instead of displaying ringtone choices directly to the user, Settings now initiates a “pick” activity for type=”ringtone”.  A new System Ringtones app (which you can see in the apps/ringtones/ directory of the Gaia repo) now handles ringtone display and selection.  System Ringtones has a manifest file that says it knows how to handle “pick” requests for ringtones, so when Settings starts the pick activity, FirefoxOS launches System Ringtones.

What the user sees has hardly changed at all, but under the covers there is a new app running.  System Ringtones let’s the user select and listen to ringtones. When she chooses one she likes and taps Done, System Ringtones returns the ringtone audio file (as a Blob) and ringtone name back to the Settings app by calling the postResult() method of the Activity object. The Settings app verifies that it can actually play the audio file and saves it to the settings database, where it is ready for use when a call is received.

The cool thing about switching to Activities for ringtone selection is that other apps can implement the pick activity for ringtones.  If more than one app is registered to handle an activity, FirefoxOS asks the user to choose which one she wants to use:

More than one app can provide ringtones

The My Ringtones app is a proof-of-concept I developed (the ringtones themselves were composed by my son, however).  If the user selects it, she sees these custom ringtone choices:

A demo app that offers custom ringtones

Tapping on a ringtone name plays the ringtone, and tapping Set passes the ringtone Blob back to the Settings app.

If you have a FirefoxOS device running version 1.2, you can try it out:

  1. In the FirefoxOS Browser app, visit
  2. Click on the Install button you see there
  3. Wait for the app to be installed
  4. Open the Settings app, tap on Sound, and then select a new ringtone. You should see “My Ringtones” as a choice along with “System Ringtones”
  5. To uninstall this app, use Settings -> App Permissions -> My Ringtones

The code for the My Ringtones app is available on GitHub and shows you how all this is done. If you’ve got ringtones that you’d like to sell (or distribute for free) through the FirefoxOS Marketplace, you can fork that app, change its name, fix up the visual design, add your new audio files, package it up and submit it to the Firefox Marketplace. Remember, though, that this only works in version 1.2 and later, and devices running version 1.2 are not yet commercially available.

Here are some final notes:

  • Wallpaper selection is handled by pick activity, too, and has been since version 1.0, so you can write custom wallpaper apps right away.  See the Gaia wallpaper app (in the apps/wallpaper/ directory) to see how it is done.  In version 1.0 and 1.1, the Settings app picks wallpaper by making a pick request for type “image/jpeg”.  In version 1.2, it also adds the type “wallpaper”.
  • I have a patch pending review that will add a “Set Ringtone” app to Gaia. If this lands, then when apps use a “share” activity to share audio files, one of the choices the user will see is to use the shared audio as a ringtone. This will allow us to use songs from the Music app as ringtones.
  • Apps that implement the pick activity may not be the official way to customize FirefoxOS. We have UX designers thinking about customization and theming. And we have other designers thinking about ways to enable the download and installation of new system ringtones.  So it may be that releases after version 1.2 will support custom ringtones in some other way.

Update: this is what I was referring to when I tweeted that FirefoxOS was the “grassrootable” phone. Creating a custom ringtone and wallpaper apps is easy enough that we hope FirefoxOS users will have many deep customization options that arise from “the grassroots”.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Comment

What is Persona?