A quick intro into cordova
- What is it?
- Open source mobile development framework
- Uses standard web technologies: HTML, CSS & Javascript
- Relies on standards-compliant API bindings (https://developer.mozilla.org/en-US/docs/Web/API). - [ ] Example: Geolocation - [ ] Example: Accelerometer
- Why is it needed?
- Painful to maintain platform specific code
- Time consuming to write in native code
- How does cordova work?
- Wraps a Web View within native app and provides an interface between javascript and the native layer
- How to get started?
Pre-requisites
- Basic HTML, CSS and Javscript knowledge
- Install: node, cordova cli, platform sdk's (android, ios etc.), emulator/simulator
Example Hello Worlld App:
-
cordova create foo com.example.foo Foo -
cordova platform add android --save -
cordova build android -
cordova run android - Similarly above 3 steps for iOS
- Example showing a basic UI element and interaction?
- Directory structure? Open individual platform specific code to dive into the core implementation
- Plugins?
- https://cordova.apache.org/plugins/
-
cordova plugin add cordova-plugin-x-toast -
cordova prepare
-
- How to write a custom plugin?
- Check an existing plugin code to understand: Example 1: https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin (Clone url git@github.com:EddyVerbruggen/Toast-PhoneGap-Plugin.git)
- Distributions
- Phone Gap
- Ionic - Has a lot of standard controls that mimics native controls and it comes with Angular
- Advanced: