4 Replies Latest reply on Oct 2, 2016 3:20 PM by kerrishotts

    cordova-plugin-camera restart app

    ivann55275236

      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 Community Professional

            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 Community Professional

                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.