Phonegap camera pugin restarts the app

2 posts, 0 answers
  1. ruchin
    ruchin avatar
    33 posts
    Member since:
    Jun 2015

    Posted 27 Aug 2015 Link to this post

    Hi,

    I am making use of phonegap camera plugin (3.5.0)to click a photo using the device camera.I am able to click a photo,but after clicking ,the app restarts.

    Here is the piece of code:

    function OnCamera(e) {

        navigator.camera.getPicture(onPhotoDataSuccess, onFail, {
            quality: 50,
            encodingType: Camera.EncodingType.JPEG,
            targetWidth: 300,
            targetHeight: 300,
            correctOrientation: true,
            saveToPhotoAlbum: true,
            destinationType: destinationType.FILE_URI
        });
    }
    function onPhotoDataSuccess(imageData) {
        // Uncomment to view the base64 encoded image data
        // Get image handle
      fileEntry.file(function (fileObj) {
    // console.log("Size = " + fileObj.size);
                if (fileObj.size > 2097152)//2Mb
                {
                    DisplayAlert("Error:Image size should be less then 2MB");
                } else {
                    var CurrentImage = document.getElementById('myImg');
                    // Unhide image elements
                    CurrentImage.style.display = 'block';
                    // Show the captured photo
                    // The inline CSS rules are used to resize the image
                    CurrentImage.src = imageData;
                    //localStorage["Img"] = imageData;
             
                }
            });
        });
        $("#lblPhotoText").hide();
    }​

     I have tried using the following in the androidmanifest.xml :

    <uses-feature android:name="android.hardware.camera" android:required="false"/>
    <uses-sdk android:minSdkVersion="7"/>​

    How can I solve this issue????

    Thanks,

    Ruchin Dayal

     

  2. Dimitar Kerezov
    Admin
    Dimitar Kerezov avatar
    10 posts

    Posted 01 Sep 2015 Link to this post

    Hi Ruchin,

    We were unable to reproduce the issue you've described.
    I see you have opened a support ticket regarding the same issue and I suggest that we continue the discussion there. After we end with a solution we can forward it here, so anyone who encounters similar matter will be able to take a reference.

    Regards,
    Dimitar Kerezov
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top