Dmitriy Dmitriy - 4 months ago 18
Android Question

How to detect where front-facing camera placed on device?

Is there any ways to detect where front-facing camera placed on Android device?

I think on cell phones it's always on top of it, near the headphone. But all tablets are different. I checked Asus Transformer, and front camera is on the side (on top if I hold it in landscape mode), but Samsung Galaxy Tab (first gen, Android 2.2) has camera on top of it, like all cell phones.

So is there way to check where front camera placed? Maybe I can do it with code, maybe there is a rule for devices? Like Android 2.x devices has it on top, and Android 3.x devices has on the side? Then what about Adnroid 4.x devices?

Answer

There is no way to do this. Read http://developer.android.com/reference/android/hardware/Camera.CameraInfo.html

There are two constants you can check:

int CAMERA_FACING_BACK The facing of the camera is opposite to that of the screen.
int CAMERA_FACING_FRONT The facing of the camera is the same as that of the screen.

So I'm sorry - no way to check if it's at the side.

Comments