Application gets restart after calling camera plugin of cordova


#1

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.


#2

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.


#3

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


#4

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


#5

$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’);
    };


#6

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


#7

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


#8

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?


#9

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


#10

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.