CordovaFirefoxOS

API shim development

Cordova FirefoxOS TODO / Progress Status (%) Developer
Accelerometer devicemotion, DeviceMotionEvent.acceleration testing on device fails, same code is working on Android 90% zalun
Camera WebActivities, Pick image example The problematic parts are specified in cameraOptions:
  • defining the source of the picture in code
  • forcing encode type
  • target size
  • camera direction

Currently only the response as URI is supported

20% zalun
Capture WebActivities The main differences are in the object returned to the callbacks, some on-the-fly transition will be needed.
Compass deviceorientation FirefoxOS provides support as an event. Use absolute parameter to check if the device is able to provide the Earth coordinate frame
Connection navigator.connection Cordova has a different object under the same navigator property name. FirefoxOS doesn't provide type of the connection to the apps. According to Harald' answer on StackOverflow "metered should be enough to tell if the user is on wifi".
Contacts WebAPI/ContactsAPI There are lacks in FxOS documentation of Contact fields (impp, url, address). Some fields are not exactly corresponding to each other. FxOS has an ability to save only one organization. Cordova has no info about (anniversary, sex, genderIdentity)
Device As for the moment FxOS does not provide any info about device to not certified apps. Following properties of device object will not returned: name, uuid, version, model
Events TBD (some of these will require a separate row in this table)
File TBD
Geolocation Using geolocation The only difference is providing a timestamp as Date object
Globalization TBD
InAppBrowser Browser The implementation is very different. Cordova uses window.open which is working in different way under FxOS. FxOS uses an iframe with mozbrowser attribute.
Media Playing and recording music files. "The current implementation does not adhere to a W3C specification for media capture, and is provided for convenience only. A future implementation will adhere to the latest W3C specification and may deprecate the current APIs".
Notification.alert window.alert UI 90% zalun
Notification.confirm window.confirm UI 90% zalun
Notification.prompt window.prompt UI 90% zalun
Notification.beep TBD
Notification.vibrate Vibration None
Splashscreen TBD
Storage TBD

Repositories

Running an early dev version

$ git clone https://github.com/jlongster/cordova-cli.git
$ cd cordova-cli && npm install
$ cd ..
$ git clone https://github.com/apache/cordova-plugman.git
$ cd cordova-plugman && git checkout ffos
$ cd ..
$ cd cordova-cli && npm install ../cordova-plugman
$ cd ..
$ git clone https://github.com/jlongster/cordova-firefoxos.git

Create a dir (possibly a bug it should be autocreated or used from another dir)

$ mkdir -p ~/.cordova/lib/firefoxos/cordova-firefoxos-dev/

Create your app:

$ ./cordova-cli/bin/cordova create fxos-app

You need to tell cordova to use the local firefoxos platform. Do this by editing .cordova/config.json in the fxos-app folder. Add the "lib" property, like this:

{
    "id": "io.cordova.hellocordova", "name":"HelloCordova",
     "lib": {
         "firefoxos": {
             "uri": "/Users/james/projects/mozilla/tmp/cordova-firefoxos",
             "version": "dev",
             "id": "cordova-firefoxos-dev"
         }
     }
}

Just change `uri` to make it point to your computer. Now you can add the platform

$ ../cordova-cli/bin/cordova platform add firefoxos

Add plugins from github or local disk

$ ../cordova-cli/bin/cordova plugin add https://github.com/jlongster/cordova-plugin-device.git
$ ../cordova-cli/bin/cordova plugin add ../cordova-plugin-device

Prepare as usual

$ ../cordova-cli/bin/cordova prepare