What is Cordova ?
“Apache Cordova is an open source framework for building cross-platform native applications using standard web technologies such as HTML, CSS and JavaScript.”
PhoneGap vs Cordova ?
PhoneGap is a distribution of Apache Cordova。
WebKit -- Chrome/Safari
Linux -- Ubuntu/CentOS
Pros and Cons
Pros
- Open Source and Free
- Web Development Skill Reuse
- Platform Support
- Plugin Architecture
Pros and Cons
Cons
- Performance
- Browser Support
- Web LAF(Look & Feel)
Architecture
Native Application Architecture
Architecture
Streamlined plugin architecture
Architecture
Streamlined plugin architecture
Architecture
Native Bridge
>>more
Installing Cordova
Requirements
Android(JDK/Ant/Android SDK/ADT)、iOS(Xcode)、Node.js、Git
Install
npm install -g cordova
>>more
Cordova CLI
- Create: Generate folder skeleton
- Build: Generate mobile native apps
- Deploy: Transfer to emulators and Devices
Cordova CLI
cordova create MyApp com.rensanning.cordova MyApp
cd MyApp
cordova platforms add android
cordova plugin add org.apache.cordova.device
cordova build android
cordova emulate android
Project Structure
myApp/
|-- config.xml
|-- hooks/
| | |-- before_xxx/
| | `-- after_xxx/
|-- merges/
| | |-- android/
| | `-- ios/
|-- platforms/
| |-- android/
| `-- ios/
|-- plugins/
| |-- org.apache.cordova.console/
| `-- org.apache.cordova.device/
|-- www/
| |-- css/
| |-- img/
` |-- js/
`-- index.html
>>more
Cordova Events
- deviceready
- pause
- resume
- backbutton
- menubutton
- searchbutton
- startcallbutton
- endcallbutton
- volumedownbutton
- volumeupbutton
- online
- offline
Cloud-based Build Services
- PhoneGap Build
- AppBuilder/Icenium
- Appery.io/Tiggzi
- Monaca
- SAE云窗调试器
>>more