NativeScript / nativescript-camera

NativeScript plugin to empower using device camera.
Apache License 2.0
92 stars 47 forks source link

Camera crashes on clicking Second Picture in App? #29

Closed dlucidone closed 6 years ago

dlucidone commented 7 years ago

I have a module which include clicking picture and displaying it and then sending it back to server. The first time everything goes smooth but if i go back and edit the image and click another picture the app crashes.

4516139756590974505-account_id 2

this is the error im getting any help? thanks

tsonevn commented 7 years ago

Hi @dlucidone, Could you provide some more info about your project and the plugins you are using in it? It would help if you could share some code with us or sample project, which could be debugged locally. You could also give us some info about your environment (CLI, node, tns-core-modules versions).

dlucidone commented 7 years ago

Hey @tsonevn thanks for replying, my deps are

"dependencies": {
 "@angular/common": "2.4.5",
"@angular/compiler": "2.4.5",
"@angular/core": "2.4.5",
"@angular/forms": "2.4.5",
"@angular/http": "2.4.5",
"@angular/platform-browser": "2.4.5",
"@angular/platform-browser-dynamic": "2.4.5",
"@angular/router": "3.4.5",
"email-validator": "1.0.4",
"nativescript-angular": "1.4.0",
"nativescript-background-http": "^2.5.1",
"nativescript-calendar": "^1.2.0",
"nativescript-camera": "0.0.8",
"nativescript-cardview": "^1.2.1",
"nativescript-checkbox": "^1.2.3",
"nativescript-drop-down": "^1.5.1",
"nativescript-fancyalert": "^1.1.2",
"nativescript-floatingactionbutton": "^2.2.7",
"nativescript-iqkeyboardmanager": "1.0.1",
"nativescript-loading-indicator": "^2.2.2",
"nativescript-permissions": "^1.2.3",
"nativescript-progressbar": "^1.0.2",
"nativescript-pulltorefresh": "^1.1.10",
"nativescript-social-share": "~1.3.2",
"nativescript-theme-core": "^1.0.2",
"nativescript-toast": "^1.4.5",
"nativescript-unit-test-runner": "^0.3.3",
"nativescript-wave-refresh": "^1.0.0",
"reflect-metadata": "^0.1.8",
"rxjs": "~5.0.1",
"tns-core-modules": "^2.5.0"
 },

tns-android version

   "tns-android": {
   "version": "2.5.0"
   }

and

  node version - v7.5.0

this is a problem i'm getting while i'm testing application on samsang galaxy A7. I'm running demo app only. I've tested in on other phones also but i think its phone specific only. Also after clicking picture and saving it the app resumes and thats the only reason i think the app crashes second times. I'm not abe to reproduce it on other devices except samsung devices.

tsonevn commented 7 years ago

Hi @dlucidone, Could you confirm that you have used CameraTestAngular application while testing nativescript-camera plugin on your device? If not, could you verify, whether you will have the same issue with the demo app?

In case you are using another app, can you give us your project or at least those part of code, where has been used the camera.

dlucidone commented 7 years ago

hey, @tsonevn

I cannot share whole project but here is the fragment of my code

onTakePictureTap(args) {
    permissions.requestPermissions([android.Manifest.permission.CAMERA,
                                    android.Manifest.permission.ACCESS_NETWORK_STATE], 
                                    "App Needs The Following permissions")
        .then(()=>{
     var milliseconds = (new Date).getTime();
     var that=this;
      takePicture({width: 300, height: 300, keepAspectRatio: true}).then((function (img) {
         let source = new imageSourceModule.ImageSource();
        source.fromAsset(img).then((source) => {
             let folder = fs.knownFolders.documents();
        var path = fs.path.join(folder.path, "ABCD"+milliseconds+".png");
         var saved = source.saveToFile(path, "png"); 
        that.mImage = path;
        });

      })
          );
        })
        .catch(()=>{
            console.log("Permission Denied !");
        });
    }
tsonevn commented 7 years ago

Hi @dlucidone, I made sample project while using the above given code snippet, however, was unable to reproduce the reported issue. Regarding that, I am attaching a sample project. Could you make the needed changes in it, which will allow us to reproduce this behavior?

At that point, you could also use nativescript-camera requestPermissions() method instead of nativescript-permissions, which will also request the needed permissions. Archive.zip

dlucidone commented 7 years ago

hey @tsonevn , Sure i will, but i'll get back to it after 3-4 days as i'm working on a plugin for week view. I'll try to add a gif showing the error. thanks

DimitarTachev commented 6 years ago

I'm closing this issue because it has been inactive for a few months.