Cordova Cheatsheet
npm commands
> npm install -g cordova
- Uses node to install the cordova program on your computer globally.
cordova commands
> cordova create demo ca.edumedia.griffis.mydemo Demo
- Uses cordova to create your project in a folder called demo with the namespace ca.edumedia.m.griffis
> cordova platform add android
- Change the last word in the command to load different platforms into your cordova project.
> cordova plugin add cordova-plugin-device
- The reverse url is used to load different plugins. Do this to add functionality into your cordova app.
> cordova build android
- Compile your source code into the android .apk file.
> cordova emulate android --target=myAdvName
- Compile and Launch your Android Cordova app in a specific emulator.
> cordova platform add browser
- Add the browser as a target for your project. A simple way of testing your interface.
> cordova run browser
- Once the browser is added to your cordova project then you can launch the app in your browser.
android commands
> android list targets
- lists all the android APIs currently installed on your computer.
> android list avds
- Lists all the android virtual devices that you have created through the command line or the android manager.
> android create avd -n bob -t android-19
- create a new android virtual device. bob is the name of the avd. android-19 is the API used by the avd.
adb commands
> adb devices
- list all the emulators and physical android devices connected to the computer.
> adb install demo.apk
- install the file demo.apk onto a connected android emulator or device
> adb install -r demo.apk
- install the file demo.apk onto a connected android emulator or device which has previously been installed. The -r stands for "reinstall".
> adb uninstall name-of-app-package
- uninstall an app from the android emulator or device.
> adb shell pm list packages
- list all the installed packages on the emulator or connected device. From this list you can get the package name for uninstalling.
emulator commands
> emulator -avd bob
- Launch the android emulator and load a specific virtual device.
miscellaneous
> monitor
- launch the monitor program to watch what is happening in the emulator or connected android device.