This mainly depends on the hardware of the device, and most devices now do not allow both cameras to be used simultaneously. Even if any device can use both cameras, if you want the application to work flawlessly on as many devices as possible (and this is what you want), you should not implement this solution. Google says:
To make your application compatible with a large number of devices, you should not make assumptions about the characteristics of the deviceβs camera
What you can do, and it depends on the application you are writing, is to periodically take pictures once with the front camera and a second time with the rear camera.
Mikel source share