Hello all I’m starting to study Ionic. Seems very interesting.
As I do with most fws/technologies I study the first thing I did was to create an isolated vm dedicated to the project. Depending on the project I normally use Vagrant or Docker to setup the development environment.
For Ionic I decided on Vagrant. So I setup my VM and installed dependencies, debugged why hot reload wouldn’t work and finally I had my initial tabs project running.
I thought next step would be easy: the Ionic Photo-gallery tutorial.
But then I started to think how could I access the camera on the host OS only to find I not only didn’t know how, but the more I thought of it the more I think it’s not possible.
Then I saw lots of unanswered questions about vagrant in this forum which amplified my sensation that this isn’t the right way to do it.
So 2 questions:
1- How do you guys create your development environment ? is this only done in the host machine without any containerization/vm in order to access hardware ?
2- If someone does use Vagrant or Docker, how do I access an hardware like a camera ?
I use a mac because that’s the only way of building for iOS locally, and I install everything in the mac directly. I would not recommend using virtual machines for mobile development as the android emulators are already virtual machines and running virtual machines inside virtual machines usually ends bad.
You can try plugging a real device to the computer and make the virtual machine see it as plugged to it and then you should be able to run from the VM to the device, but I always have problems with the USB connections in VMs, so not 100% sure it will work.
Actually I’ve made the camera work on vagrant, but I still want to know how it’s the normal way to setup a development environment in Ionic.
If anyone is interested the solution for the camera is here: ionic framework - How to use a camera in a vagrant VM? - Stack Overflow
Since your answer mentions Chrome I guess you managed to test the web version of your app in Chrome, but when developing mobile apps you should be testing on Android (emulators and real devices) and iOS (simulators and real devices) as native apps, not just in web browsers. And that’s what can be tricky as android emulators are VMs themselves.
Unless you don’t plan to launch mobile apps and you are planning on developing only mobile websites.
If you plan to create mobile websites, you’ll need to use Capacitor. You can check all you need to install here
I intend to develop apps. But for the moment, all I want to do is to finish Phone-gallery tutorial. And having access to the camera will suffice. I will learn that things in the near future 