This is a migrated thread and some comments may be shown as answers.

Phonegap camera pugin restarts the app

1 Answer 46 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
ruchin
Top achievements
Rank 1
ruchin asked on 27 Aug 2015, 11:35 AM

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

 

1 Answer, 1 is accepted

Sort by
0
Dimitar Kerezov
Telerik team
answered on 01 Sep 2015, 11:02 AM
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.

 
Tags
General Discussion
Asked by
ruchin
Top achievements
Rank 1
Answers by
Dimitar Kerezov
Telerik team
Share this question
or