How to use Native Camera in Ionic project, ionicnative
This article describes how to use the camera of a device in an ionic project.
Ionic version: v3.2.0/2017-05-10/MIT Licensed/Release Notes
1) The first step is to install ionic-native/core. All functions that use Native cannot be saved in this step. Npm install @ ionic-native/core -- save
Ps: for the first step, the official note is that ionic-native/core is included in every Ionic application by default. Note the red rectangular text.
In other words, if the development environment is the latest version and the Ionic version has not been upgraded during this period, you can skip this step without manual installation by the developer.
However, in the actual development process, you may encounter the following problems:
The reason is that the upgrade... Upgrade... Upgrade. My project was created based on Ionic v2.2.2. However, I have been officially upgraded to v3.2.0 through Ionic.
The solution is:
2) Add the cordova plug-in to your project. Ionic cordova plugin add cordova-plugin-camera
3) install the corresponding node_moudles. Npm install -- save @ ionic-native/camera
4) Find the app. moudle. ts file under the Code src-> app and Add this plugin to your app's module. This step can be done at the end, but do not forget.
5) The other is to add code on how to use Camera.
6) After coding is complete, use Chrome to test the cordova plug-in.
Ionic cordova platform add browser
Ionic cordova run browser
For more information about the reason why the ionic serving is not direct, see commit.
Refer:
Ionic Official Website: http://ionicframework.com/docs/native/camera/
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.