Android Studio
In the project folder, install Cordova CLI1
$ sudo npm i -g cordova
Add Android platform using Cordova1
2$ npm i -g
$ ionic cordova platform add android
(By calling ionic cordova
you are allowing the Ionic CLI to “wrap” the Cordova CLI)
Compile all the “web assets” (e.g ts files to js, and sass to css) and gets them ready for action. And copy all the relevant files into the right places within the android
directory.1
ionic cordova prepare android
Open Android Studio, choose the option “Import Project(Gradle, Eclipse ADT, etc.)”
OR File -> New…-> Import Project
Ionic DevApp
Run $ ionic serve -c
Open Ionic DevApp on mobile phone (ensure the phone uses the same network with computer).
Use Camera Plugin
Install1
2$ ionic cordova plugin add cordova-plugin-camera
$ npm install --save @ionic-native/camera
Add Module in module.ts
1 | ... |
Taking the picture
1 | import { Component } from '@angular/core'; |