Skip to content

Latest commit

 

History

History

cordova

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Setup

First of all, you must have:

  • Android SDK
  • Cordova: sudo npm install -g cordova cordova-icon
  • Imagemagik: sudo apt-get install imagemagick

Use Android SDK Manager to download files under Android 5.0.1 (API 21) and from the Extras folder Android Support Repository, Google Play Services and Google Repository.

Cordova plugins are not tracked in the version control. They must be initialized:

cd cordova
./cordova-setup.sh <SENDER_ID>

Where the <SENDER_ID> parameter is the project number in the Google Developer Console. To find the project number, login to the Google Developer Console, select your project, and click the menu item in the screen shot below to display your project number.

Screenshot

Run the application in the Android emulator

Create an AVD from the Android Virtual Device Manager. The Android emulator target should be of the form Google APIs (Google inc.) API Level 21.

cordova emulate android

# Or run it in your device
cordova run android --device

Debugging the app in Android

Cordova app is configured to use teem.works server by default. If you want to use your own local server, copy config.js.sample to your config.js in the root folder.

cp config.js.sample config.js

Change hosts and ports at ../config.js and also at config.xmlto point to your LAN/Internet device's IP (eth0, wlan0, etc).

The app can be accessed and debugged using Weinre.

At config.js, uncomment the config.weinre lines, and restart the server:

gulp

Now, you should be able to access weinre's console at:

http://[lan-or-internet-ip]:8080/client/#anonymous

When adding a new plugin to the app

Cordova's js files are distributed with the web application. ./cordova-setup.sh copies them automatically to other folder, which is checked-in in git.

So, after adding a new plugin, commit them with git.

Releasing and signing the apk

You need to get the keystore from your organization private repo or generate your own.

Then copy build.json.example to build.json.

cp build.json.example build.json

And customize it with the path to the keystore.

To build the package, bump the app's version at config.xml and then:

cordova build --release

The package will be stored at cordova/platforms/android/build/outputs/apk/android-release.apk.

Upload it to https://play.google.com/apps/publish/.