How to open native camera in ibm worklight

Ibm Worklight have samples that calling the native app, but that was created in worklight itself eg: module_09_1_Android_CombiningNativeAndWebPages in this sample in android folder itself they creating one activity "com.AndroidShowNativePage.HelloNative" (package name) that activity was invoking from that javascript.

But, i need to call the native camera "" from the worklight is that possible ? if yes, please share your knowledge. Thanks in Advance!!



Use this function in your applicaton. By default Cordova plugin is installed in worklight application. you need to just call its functionality

function takePicture() {
        function(data) {
            var img = dom.byId('camera_image');
   = "visible";
   = "block";
            //img.src = "data:image/jpeg;base64," + data;
            img.src = data;
            dom.byId('camera_status').innerHTML = "Success";
        function(e) {
            console.log("Error getting picture: " + e);
            dom.byId('camera_status').innerHTML = e;
            dom.byId('camera_image').style.display = "none";
        { quality: 50, destinationType:, sourceType :});

Why write code that will work on Android and not on iPhone? Worklight uses PhoneGap, so you can use camera.getPicture and get to your application the image taken with the camera as base64. cameraSuccess, cameraError, [ cameraOptions ] );

See PhoneGap documentation for more information (


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.