Search code examples
firefox-os

Check if FirefoxOS application is updated or installed for the first time


Is it possible to obtain if installed application on the Firefox OS device is updated - there was already a previous version of the application ?

I would like to display a splash notification only for new users.


Solution

  • As far as I know, there is no API for that and there is no real need for that either. What you might want to do is to check at lunchtime a few things.

    You could use the localStorage api to store a value... let say a version number.

    • If the value isn't present in the localStorage, then it means that the app is newly installed.
    • If it's present and the value is equal to the one you expect... then you have the app already installed and "initialized"
    • If it's present and the value is lower than the one you expect, then you have updated to a newer version of your app.

    After the app is initialized, save the value in the localStorage or indexedDB. There's nothing magic about it.