Application gets restart after calling camera plugin of cordova

Hello ,

I am using cordova’s camera plugin, but when i use this plugin my, app gets restart. i dont know why application gets restart when i choose photo from gallery or capture photo from camera plugin.

Am i doing something wrong?

Thank you.

If you are running on Android device with a low memory, it likely happens. The OS kills you app for allocating memory for the camera app.

Device has 512 MB RAM, its work fine in emulator but not in my device with same RAM size (512 MB)

Can you share your app code so that I can try it on my phone.

$scope.fromAlbum=function(){
        
        $rootScope.showLoading();
        
        navigator.camera.getPicture($scope.loadImage, function(){ $rootScope.hideLoading(); }, {
            destinationType: Camera.DestinationType.DATA_URL,
            sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM,
            encodingType: Camera.EncodingType.JPEG
        });
        
    };
    
    $scope.fromCamera=function(){
        
        $rootScope.showLoading();
        
        navigator.camera.getPicture($scope.loadImage, function(){ $rootScope.hideLoading(); }, {
            destinationType: Camera.DestinationType.DATA_URL,
            sourceType: Camera.PictureSourceType.CAMERA,
            encodingType: Camera.EncodingType.JPEG
        });
        
    };
    
    
    $scope.loadImage=function(imageSrc){
        UserImages.tmpImage=“data:image/jpeg;base64,”+imageSrc;
        $rootScope.hideLoading();
        $location.path(’/crop-image’);
    };

@jay if possible, can you bundle and share the zip that I can directly package using ionic and test on my phone.

Hi Gaurav, I am using android device, do you use android device for this ?

I am also facing this issue. I am running the app on MotoG which is 1GB RAM device. Did you find any solution for this?

Did you get it? I’m facing this trouble too now

hi

downgrade camera plugin may help you.
I had same problem and it is fixed by downgrading camera plugin.

i was using 0.3.6 and downgraded to 0.3.5 and it’s start working.