by

Closing a FirefoxOS app

The documentation for FirefoxOS doesn’t make it obvious how to completely close an application. Makes some sense, since their view seems to be that apps are simply web applications, and should be always on. However, I don’t think this always applies.

Fortunately, there’s a way to do what I want:

1window.close()

My use case is the following. I am building an app for FirefoxOS that makes extensive use of fine-grained geolocation. GPS uses up a lot of battery, and it’s not trivial for the app to tell when to use it and when not. Therefore, I need a way for users to close the app, safe in their knowledge that it won’t be draining resources in the background.

I have built a little proof of concept that I have published on Github. It works on my FxOS 1.1 phone (ZTE Open).