- Node v0.12+
- Preferably via nvm, e.g.
nvm use [version]
- Preferably via nvm, e.g.
- Cordova, Gulp, and CCA toolchain:
npm install -g cordova cca gulp-cli - Yarn:
npm install -g yarn - Android SDK
-
To completely install the SDK, you must:
-
run
[sdk directory]/tools/android sdkand setup the tools -
Minimal packages that must be installed:
- Android SDK Tools
- Android Platform-tools
- Android SDK Build-tools 22.0.1
- Android 5.1.1 (API 22) > SDK Platform (this may also require you to install higher SDK Platform versions)
- Extras > Android Support Repository
- Extras > Android Support Library
-
Optionally, install a system image for the emulator.
-
After installing prerequisites, run:
# Install dependencies and set up build environment
yarnTo build as an Android app:
# Setup app manifest, bower dependencies, CSS, and translations
gulp app
# Package
cca prepare android
cca build android# Run on emulator
cca run android --emulator
# or run on a connected device
cca run android --deviceOnce running, you can open Chrome at chrome://inspect to get live debugging using Developer Tools.
cca build android --releaseNB: The app can be loaded as a Chrome App (standalone) or Chrome extension (browser-embedded).
Only run this command if you want to build the extension version. Otherwise skip to Running.
gulp extensionIn Chrome, add the "unpacked extension":
chrome://extensions
- Ensure
Developer modeis checked. - Click the
Load unpacked extension...button and select thewwwsubdirectory
Now you should see the Measure.app icon on the toolbar.
To create a .crx file, open:
chrome://extensions
Click the Packed extension... button and select the platforms/browser/www subdirectory.
This will create a www.crx and associated private key www.pem. You'll need both to distribute this extension to testers.
To publish as a Chrome App, you'll need to:
- Edit the version in
www/manifest.jsonto be higher than the previous version, Note: 0.15 < 0.16 but 0.15 > 0.2 - Zip up the
wwwfolder - Log into the Chrome Developers Console
- Edit the existing application
- Upload new version, and save to publish the app
- Publishing takes ~15-30 minutes to fully publish an update
- Force update the extension in
chrome://extensionsto pull the update
User interface strings are tagged in the source code using the getttext system. Strings presented in the application's user interface are coded with gettext function calls, for example:
# Examples from an HTML template:
<ion-view view-title="{{ 'About' | translate }}">
<span translate>About M-Lab Measure App</span># Examples from a JS file:
.controller("manualTranslationStrings", function (gettext) {
var translationStrings = {
"Time": gettext("Time"),
"Service Provider": gettext("Service Provider"),
"Your Location": gettext("Your Location"),When the application is built, all strings properly identified by gettext function calls are automatically parsed into an updated master file of and saved in: /www/translations/source/application.pot. All of the strings in the master file are in English.
This file must then be uploaded to the project's Transifex account. Click the button labelled "Updating source file", then notify translators that new strings are available to translate.
When translators have completed their work, the 100% complete language files may be downloaded for use, and saved in /www/translations/lang. Subsequent builds of the extension or app will then automatically include the updated language strings or new language string sets.