3 Replies Latest reply on May 23, 2017 1:53 AM by jcesarmobile_

    Camera is not open in android phonegap app.

    abhishekpandya Level 1

      I am loading a webpage using inappbrowser in phonegap android app.This web page have one button which opens camera to capture the image.

      But in android device camera does not open,suprisingly it works fine in all ios device.

       

      Following is my code:

      function sharephoto() {

          document.getElementById("mySidenav").style.width = "0";

          setTimeout(function() {

              $('#loading').show();

          }, 100);

          if (online()) {

              var ref = cordova.InAppBrowser.open('https://utranscript.org/mobile/share-photo/', '_self', 'location=no,closebuttoncaption=Back,hidden=yes,hardwareback=yes,toolbar=yes', 'clearcache=yes,clearsessioncache=yes', 'enableViewportScale=yes');

              ref.addEventListener('loadstop', function() {

                  ref.show();

                  $('#loading').hide();

              });

              ref.addEventListener('loadstart', function() {

                  ref.hide();

              });

          } else {

              setTimeout(function() {

                  $('#loading').hide();

              }, 2000);

              alert("Please Connect to the internet");

          }

       

      }

      Note: I used cordova-plugin-camera.