Ionic App w / Cordova, how to integrate the camera?

I am new to Node.js and started building my own application with the Ionic and Cardova Camera APIs.

I am currently launching the camera of an Android device using this demo.

What I want to do is insert the camera into the application, and not launch the camera, but I don’t know where to start.

Does Cordova support this type of functionality or will I have to use PhoneGap?

For example, this is in phonegap.

Or maybe write your own camera?

+4
source share
1 answer

Indeed, you can do this with Ionic. Take a look at this official guide .

In short, this is:

  • cordova org.apache.cordova.camera
  • , :

    function takePicture() {
      navigator.camera.getPicture(function(imageURI) {
    
        // imageURI is the URL of the image that we can use for
        // an <img> element or backgroundImage.
    
      }, function(err) {
    
        // Ruh-roh, something bad happened
    
      }, cameraOptions);
    }
    Hide result
  • < GitHub

0

All Articles