5 Replies Latest reply on Aug 30, 2018 3:02 PM by savannas36346395

    cordova-plugin-camera restart app

    ivann55275236 Level 1

      Hello, i am using this plugin

      here is code

       

      navigator.camera.getPicture(success, error, {

        quality: 100,

        destinationType: Camera.DestinationType.FILE_URI,

        sourceType: Camera.PictureSourceType.CAMERA,

        allowEdit: false

        });

       

      some times when i choose photo - it restart my app.

      so the questions why restart happen? and what the problem

        • 1. Re: cordova-plugin-camera restart app
          VectorP Level 4

          1. Which OS? What version?

          2. What device are you having this problem with? How does it perform on your other test devices?

          3. How do you make sure you're using the Camera plugin, and not html5's Camera API?

          Are you waiting for the deviceready event to fire before attempting to getPicture()?

          4. Which plugin version did you reference?

          5. Are you building locally or using PGB?

          • 2. Re: cordova-plugin-camera restart app
            kerrishotts Adobe Employee

            In addition to @VectorP's already excellent list of questions, here's a couple more:

             

            1. Do you need 100% quality? Try with a little less (like 80%) and see if the issue is mitigated any.

             

            2. Check your device's logs for any information around the time of the issue. There may be a clue buried there.

             

            Also, I'm guessing that you're running on Android since you're talking about the app restarting. If so, the following documentation should be of use (specifically the lifecycle portion):

             

            Android Platform Guide - Apache Cordova

            • 3. Re: cordova-plugin-camera restart app
              ivann55275236 Level 1

              There is a problem with photolibrary too

               

              navigator.camera.getPicture(success, error, {

                quality: 100,

                destinationType: Camera.DestinationType.FILE_URI,

                sourceType: Camera.PictureSourceType.PHOTOLIBRARY,

                mediaType: Camera.MediaType.VIDEO,

                allowEdit: false

                });

               

              quality- i think does not matter 0-100%.

              Some times it is restart my app whenchoos picture from library.

              click plugin to open galary, list my photos, choose one, labrary close and app restart.

               

              I use phonegap cloud to build, last version of plugin and wait deviceready.

              • 4. Re: cordova-plugin-camera restart app
                kerrishotts Adobe Employee

                Did you read about and handle the Android Lifecycle as described here: Android Platform Guide - Apache Cordova? If you haven't, you must, since Android is free to terminate your process if needed. If you have, and it isn't working, please share some code so we can be of assistance.

                • 5. Re: cordova-plugin-camera restart app
                  savannas36346395 Level 1

                  Well this discussion thread ends no where. I read the article that was linked to in the last post and that told me nothing about what I should expect not to mention I tried the example almost line for line and it still shuts down the app and returns me to the log in screen. I find it interesting that no one else is having this issue and that there are no solutions anywhere showing this actually working. So the simple questions I'm trying to get answered are:

                   

                  1) Is the expected behavior to go all the way back to the login screen, login and use the "resume" payload to get me back to where I was in the app?

                  2) Can this be stopped using PhoneGap or do I need to develop an android specific application in java to actually be able to use the camera in a UX friendly way?

                  3) What is enough memory to stop this from happening in the first place, if it's even a memory issue?

                   

                  Thanks