How to Launch Front Camera with Intent

Launch front camera with intent

I am trying to open the front camera directly with Intent

There is nothing for that in the Android SDK.

Below is my code

There are hundreds, perhaps thousands, of different camera apps available for Android. Some are pre-installed; some are user-installed. None have to honor those undocumented Intent extras.

This code is not working on S6(7.0). However it is working on S5,S4,Nexus 6P(8.0).

There are ~20,000+ Android device models. Only some might have a pre-installed camera app that honors those undocumented Intent extras.

So is this some kind of bug of Samsung or there is something wrong in my code.

Samsung's camera app for that particular device simply does not honor those undocumented extras.

How to choose “front camera” on new intent?

Officially, there's no intent that targets the front-facing camera. Your code might work on some phones, though. See here for more details

Open back camera on Android using Intents

You could try using

intent.putExtra("android.intent.extras.CAMERA_FACING", 1);

The caveat with this answer is that the camera app is not the same on all devices, and in many devices the default camera app is developed by the OEM. So this is more of a workaround really. I believe the front camera does not have a concrete API because many apps could potentially abuse it for spying and other purposes.



Related Topics



Leave a reply



Submit