I know that we can access the front-facing camera on pre-Gingerbread Galaxy S devices by setting the "camera-id"
Camera parameter:
Camera cam = Camera.open();
Camera.Parameters params = cam.getParameters();
params.set("camera-id", 2);
The problem is, not all Galaxy devices have a front-facing camera. These devices DO have "camera-id"
parameter, AND it allows me to set it to 2 (front). As far as I have found, the only way to determine presence/absence of FFC is to see if startPreview()
throws an exception when "camera-id"
is 2. This is kind of an awkward fix especially when I'm trying to support multiple devices.
Has anyone found a way to query the number of cameras on a 2.1 or 2.2 Galaxy S, or at least determine the presence of a front-facing camera?
Thanks!
If you require a front-facing camera you can put that in your AndroidManifest.xml like this:
<uses-feature android:name="android.hardware.camera.front" android:required="true" />
If you don't require it and want to check at runtime you can use the PackageManager like this:
PackageManager.hasSystemFeature(PackageManager. FEATURE_CAMERA_FRONT);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With