I have been using ionic for a while for doing web based mobile sites, I haven’t used ngCordova or cordova plugins. I have got a new requirement to access camera and send the images back to server.
can I use cordova in a web application (not a app)?
For example, say if my website is going to be www.sendmyphoto.com in home page if I have a button, and when i click the button, can i call cordova camera plugin to load the camera?
I mean from chrome/safari browser in mobile or tablet?
If its possible, please give some directions how I can achieve this?
Hello,
ionic is designed to work on mobile devices, not as web apps. Nevertheless it should run in browsers. Ionic/Cordova wraps web apps in a native app. When you use a cordova funtion (e.g. camera access) it uses the native platform functions. This is not possible using a web app inside a browser.
For your specific use case, accessing the camera, you may use the html image input type. This shows a “gallery select / camera” action on most devices.
This seems to be simple misunderstanding of cordova.
Soo cordova is really just a native webview that can call native code (obj-c, java, c#) and access functions on device. Ionic is just the UI layer. Ng-cordova is a set of angular services for working with cordova plugins.
So if your ionic app is running as a web site (just a warning, not really the purpose of ionic), you are not going to be able to use any cordova functionality, since it’s not compiled as a native app.