Note: you're trying to use Intent correctly (and also note @skydroid answer below). However, it doesn't work for you probably because of below:
Standard Android Camera
Using Intent
you only open the standard android camera application (back camera is default there).
Never use android.intent.extras.CAMERA_FACING
property - this is an undocumented feature that stopped working starting from some of the android versions.
Camera API
To open a front camera you should use Camera API - do things like choosing the front camera, showing a preview in a view, and taking pictures manually. Answer of @skydroid shows how to find the front camera. Note that Camera.open()
doesn't open a camera for the user as you might expect, you should manually show the preview.
Also note, since API level 21 the Camera API is deprecated and docs recommend to use Camera 2 API instead. But Camera API remains fully functional and you have no other choice if you want support older versions (< API level 21) as well.