Cordova: How To Take A Picture Without Using Camera App
I'm working on an Android App with Apache Cordova. I'd like to take a picture without opening camera application. I'd like the camera shoot by clicking a button from my app and sav
Solution 1:
Solved using CameraPictureBackground plugin:
functionsuccess(imgurl) {
console.log("Imgurl = " + imgurl);
//here I added my function to upload the saved pictures//on my internet server using file-tranfer plugin
}
functiononFail(message) {
alert('Failed because: ' + message);
}
functionCaptureBCK() {
var options = {
name: "Image", //image suffixdirName: "CameraPictureBackground", //foldernameorientation: "portrait", //or landscapetype: "back"//or front
};
window.plugins.CameraPictureBackground.takePicture(success, onFail, options);
}
<button onclick="CaptureBCK();">CapturePhoto</button> <br>
You will find your pictures under CameraPictureBackground directory in your device acrhive. I used also file-transfer plugin in order to directly upload the pictures on my server over the internet.
Post a Comment for "Cordova: How To Take A Picture Without Using Camera App"