Ng-cordova camera app restarting app on first time

I am using ng-cordova camera plugin to click picture but after clicking picture app get restart


$scope.getPhoto = function() {
     var options = { 
      quality : 50, 
      destinationType : Camera.DestinationType.NATIVE_URI, 
      sourceType : Camera.PictureSourceType.CAMERA, 
      allowEdit : false,
      encodingType: Camera.EncodingType.JPEG,
      targetWidth: 300,
      targetHeight: 300,
      popoverOptions: CameraPopoverOptions,
      saveToPhotoAlbum: true
    if(typeof $scope.lastPhoto === 'undefined') {
      $scope.lastPhoto = [];

    console.log("Inside get photo");
    $cordovaCamera.getPicture(options).then(function(imageURI) {
      console.log("Inside Home Control Camera");
        //$scope.lastPhoto = imageURI;
        console.log( $scope.lastPhoto);
        //$scope.lastPhoto = imageURI;

      }, function(err) {
        console.log("error in camera");

Neither success nor error function is calling after clicking picture app just restarts.
I tried to find answers - I find this but these solution does not solve this problem.

If anyone know solution please share .


In which device are you testing the app? There is a known issue in some Android devices that when the camera is triggered your app activity goes background and when the picture is taken the device erroneously kills the activity to free memory.

I found this bug in the Moto G 2014.

There is a plugin that might fix your problem called Foreground Camera Plugin

I am using Redmi 1s (Android v4.3) .

Then I tried this plugin , it is working on Redmi but crashing on Nexus 5 .

Have you tested Foreground Camera Plugin app on different devices? and what the link for above plugin.


You can try this plugin:

Is a fork of the official Camera plugin but only for Android to prevent your app from being killed.

Hope it helps. :wink:

Thanks xMarston I also need Forground Gallery , do you know any?

Even i am facing the similar issue, has any one resolve this?