Hybrid Application Developer Question: Download Hybrid Application Developer PDF

How to access mobile phone native functionality in Ionic applications, for example the camera?

Tweet Share WhatsApp

Answer:

Ionic does not provide a camera API out of the box. However, since Ionic uses plugins architecture, and because it is based on Cordova, we can use Cordova plugins in our application. Ionic team provides a set of Cordova extensions with Angular wrappers, and they can be found at ngCordova.

To use Cordova plugins, we need to install the plugin using Ionic command install <plugin name>. In some cases, we will additionally need to add the plugin’s Angular module to your Angular application too.

To use a mobile phone’s camera in the Ionic application, we can call the camera API by using cordova-plugin-camera that is hosted on GitHub. This plugin defines a global navigator.camera object, which provides an API for taking pictures and for choosing images from the system’s image library.

Download Hybrid Application Developer PDF Read All 49 Hybrid Application Developer Questions
Previous QuestionNext Question
Tell us what is PhoneGap and why to use it?As you know performance of Ionic application is bad on older Android devices. Why is this, and what can be done to improve it?