How to open native camera in ibm worklight

前端 未结 2 2098
一整个雨季
一整个雨季 2021-01-15 04:17

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

2条回答
  •  耶瑟儿~
    2021-01-15 04:39

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

    function takePicture() {
    
        navigator.camera.getPicture(
            function(data) {
                var img = dom.byId('camera_image');
                img.style.visibility = "visible";
                img.style.display = "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: navigator.camera.DestinationType.FILE_URI, sourceType : navigator.camera.PictureSourceType.CAMERA});
    };
    

提交回复
热议问题