ads

mercredi 23 septembre 2015

Cordova camera crashes the app on android



Hey I posted this post to stackoverflow but with no answers I came here to see if there's someone here who could help me.

I'm developing application with cordova & angularjs where user is able to take photos using the official camera plugin

Camera settings:


Code:


  {
        sourceType: Camera.PictureSourceType.CAMERA,
        correctOrientation: true,
        quality: 90,
        allowEdit: false,
        targetWidth: 1200,
        destinationType: Camera.DestinationType.FILE_URI,
        encodingType: Camera.EncodingType.JPEG,
        saveToPhotoAlbum: false
    }


What I tried to prevent crashing is this:

Code:


$scope.removePhotoFromDeviceMemory = function (uriToPhoto) {
        $scope.filesystemImageSuccess = function (fileEntry) {
            console.log("REMOVING POHOT FROM DEVICE")
            console.log(fileEntry);
            function removeSuccesful() {
                console.log("IMAGE REMOVED");
            }

            function removingFailed() {
                console.log("IMAGE REMOVING FAILED");

            }

            fileEntry.remove(removeSuccesful, removingFailed);
        }
        $scope.filesystemImageFail = function () {
            console.log("fuuuuuuuuuuuuuuuuuuuuuuuuuuuuu");
        }
        window.resolveLocalFileSystemURL(uriToPhoto, $scope.filesystemImageSuccess, $scope.filesystemImageFail)
    }


So app deletes all taken photos from phone instantly after the photo is sent to backend.

So I'm currently using the FILE_URI to prevent crashings DATA_URI has, but on older devices it crashes still when user has taken ~20-40 photos.

Running out of ideas here. Any help highly appreciated!

From ADB:


Code:


E/AndroidRuntime(30705): java.lang.RuntimeException: Unable to resume activity {com.myapp/com.myapp.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=-1, data=null} to activity {com.myapp/com.myapp.MainActivity}: java.lang.NullPointerException




Aucun commentaire:

Enregistrer un commentaire