You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2020/01/07 12:02:58 UTC

[GitHub] [cordova-plugin-camera] hostcia opened a new issue #544: Cannot read property 'getPicture' of undefined

hostcia opened a new issue #544: Cannot read property 'getPicture' of undefined
URL: https://github.com/apache/cordova-plugin-camera/issues/544
 
 
   I'm new to Cordova.
   
   I am trying to use the cordova-plugin-camera plugin.
   
   I generate the apk, and when I'm going to test it on my phone (**MotoG 3 - Android 6.0**), it doesn't open.
   
   Using debug shows this error:
   
   > Cannot read property 'getPicture' of undefined
   
   
   This code of mine:
   
   
   ````
   <!DOCTYPE html>
   <html>
     <head>
       <meta name="format-detection" content="telephone=no">
       <meta name="msapplication-tap-highlight" content="no">
       <meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
       <link rel="stylesheet" type="text/css" href="css/style.css">
       <link rel="shortcut icon" href="img/favicon.png"  />
   
       <title>Foto</title>
     </head>
     <body>
   
       <div class="app">
   
         <button type="button" class="btn" id="cameraApp">Tirar foto</button>
         <img src="" id="myImage">
   
   
       </div>
   
   
   
   
       <script src="js/jquery-3.4.1.min.js"></script>
   
       <script>
   
         document.getElementById('cameraApp').addEventListener('click', cameraApp);
         function cameraApp() {
           navigator.camera.getPicture(onSuccess, onFail,{
             quality: 100,
             saveToPhotoAlbum: true,
             destinatinType: Camera.DestinatinType.DATA_URL
           });
   
           function onSuccess(imageData){
             var image = document.getElementById('myImage');
             image.src = "data:image/jpeg;base64," + imageData;
           }
   
           function onFail(message){
             alert('Falhou: ' + message);
           }
         }
   
       </script>
   
   
     </body>
   </html>
   
   ````

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-camera] jcesarmobile commented on issue #544: Cannot read property 'getPicture' of undefined

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #544: Cannot read property 'getPicture' of undefined
URL: https://github.com/apache/cordova-plugin-camera/issues/544#issuecomment-573752303
 
 
   You have to link `cordova.js` in your `index.html` for Cordova and it's plugin to work.
   
   The file is generated/copied on build time, so you just have to add the link despite the file is not there yet. `<script src="cordova.js"></script>`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-camera] jcesarmobile closed issue #544: Cannot read property 'getPicture' of undefined

Posted by GitBox <gi...@apache.org>.
jcesarmobile closed issue #544: Cannot read property 'getPicture' of undefined
URL: https://github.com/apache/cordova-plugin-camera/issues/544
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org