FirefoxOS entry points
« Monday, August 24, 2015 »

firefoxos

While working on a custom HomeScreen for my FirefoxOS phone, I had to work my way around some undocumented things. As far as I understand, the webapp manifest documentation on MDN is far from being complete. While using the Application Manager, I realized that some application had no icons and as I knew, the Communication app should have multiple buttons.

It was easy to understand how it works though, the entry_points property on the manifest allows an application to add additional entry_points when launch_path isn't enough. The structure of the entry_points is a key for the entry_point id and a value that is a manifest like object.

For example:

...
"entry_points": {
    "dialer": {
        "name": "Dialer",
        "description": "...",
        "launch_path": "/dialer",
        "icons": {
            "32": "/img/dialer.png",
            "64": "/img/dialer64.png"
        },
        "locales": {
            "lang": {
                "key": "value",
                "key1": "value1"
            }
        }
    }
}
...

This would declare a dialer entry point with a set of icons, name, description and translations. This is quite easy to understand. When it's time to launch the application for a particular entry point. Instead of calling the method: DOMApplication.launch(), you have to call the method with the entry point as a parameter.

In order to call the dialer entry point on the communication webapp, you have to call.

app.launch('dialer')

That said, when looping over all applications using the navigator.mozApps.mgmt.getAll() method, make sure to check for entry points if there is any. Calling launch on an application with entry_points but without launch_path will open the app with the DOMApplication.origin property. In the case of the communication application, it just opens a directory browser without actually opening anything useful.

comments powered by Disqus

Copyright © 2015 Loïc Faure-Lacroix